View Issue Details

IDProjectCategoryView StatusLast Update
0013379ScribusUser Interfacepublic2015-10-04 18:07
ReporterFirasH Assigned ToFirasH  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.5.1svn 
Fixed in Version1.5.1svn 
Summary0013379: Fix non updated strings in Properties > Colors after language change
DescriptionFix non updated strings in Properties > Colors after language change.
The patch is tested and works fine... only thing I'm not very sure about is:
    setCurrentItem(0);
Additional Information1.5.1.svn (20430)
TagsNo tags attached.
PatchYes

Activities

FirasH

2015-09-28 11:39

developer  

13379-Patch.diff (10,448 bytes)   

diff --git a/scribus/ui/propertiespalette.cpp b/scribus/ui/propertiespalette.cpp
--- a/scribus/ui/propertiespalette.cpp
+++ b/scribus/ui/propertiespalette.cpp
@@ -929,6 +929,7 @@
 	shapePal->languageChange();
 	groupPal->languageChange();
 	imagePal->languageChange();
+	Cpal->languageChange();
 	linePal->languageChange();
 	textPal->languageChange();
 	tablePal->languageChange();
diff --git a/scribus/ui/cpalette.h b/scribus/ui/cpalette.h
--- a/scribus/ui/cpalette.h
+++ b/scribus/ui/cpalette.h
@@ -127,6 +127,7 @@
 	void toggleStrokePattern();
 	void changeHatchProps();
 	void unitChange(double, double, int unitIndex);
+	void languageChange();
 signals:
 	void NewPen(QString);
 	void NewBrush(QString);
diff --git a/scribus/ui/cpalette.cpp b/scribus/ui/cpalette.cpp
--- a/scribus/ui/cpalette.cpp
+++ b/scribus/ui/cpalette.cpp
@@ -1890,3 +1890,111 @@
 	hatchDist->setNewUnit(unitIndex);
 	currentUnit = unitIndex;
 }
+
+void Cpalette::languageChange()
+{
+	//Needed to avoid issues if an item is selected and patterns are available
+	setCurrentItem(0);
+
+	//Fill tab
+	tabFillStroke->setTabText(0, tr("Fill"));
+	fillModeLabel->setText( tr("Fill Mode"));
+
+	int oldIndex = fillModeCombo->currentIndex();
+	fillModeCombo->clear();
+	fillModeCombo->addItem( tr("Solid"));
+	fillModeCombo->addItem( tr("Gradient"));
+	fillModeCombo->addItem( tr("Hatch"));
+	fillModeCombo->setCurrentIndex(oldIndex);
+
+	fillShadeLabel->setText( tr("Shade:"));
+
+	oldIndex = gradientType->currentIndex();
+	gradientType->clear();
+	gradientType->addItem( tr("Linear"));
+	gradientType->addItem( tr("Radial"));
+	gradientType->addItem( tr("Conical"));
+	gradientType->addItem( tr("4 Colors"));
+	gradientType->addItem( tr("Diamond"));
+	gradientType->addItem( tr("Mesh"));
+	gradientType->addItem( tr("Patch Mesh"));
+	gradientType->setCurrentIndex(oldIndex);
+
+	gradEditButton->setText( tr("Move Vector"));
+
+	//Custom list needs updating
+
+	gradientExtendLabel->setText( tr("Extend:"));
+
+	oldIndex = gradientExtend->currentIndex();
+	gradientExtend->clear();
+	gradientExtend->addItem( tr("None"));
+	gradientExtend->addItem( tr("Pad"));
+	gradientExtend->setCurrentIndex(oldIndex);
+
+	colorPointLabel->setText( tr("Color"));
+	colorShadeLabel->setText( tr("Shade"));
+	colorAlphaLabel->setText( tr("Transparency"));
+
+	colorMeshPointLabel->setText( tr("Color:"));
+	shadeMeshPointLabel->setText( tr("Shade:"));
+	transparencyMeshPointLabel->setText( tr("Opacity:"));
+	editMeshColors->setText( tr("Edit Colors"));
+
+	hatchDistLabel->setText( tr("Distance:"));
+	hatchAngleLabel->setText( tr("Angle:"));
+	hatchTypeLabel->setText( tr("Type:"));
+
+	oldIndex = hatchType->currentIndex();
+	hatchType->clear();
+	hatchType->addItem( tr("Single"));
+	hatchType->addItem( tr("Double"));
+	hatchType->addItem( tr("Triple"));
+	hatchType->setCurrentIndex(oldIndex);
+
+	hatchLineColorLabel->setText( tr("Line Color:"));
+	hatchBackgroundLabel->setText( tr("Background:"));
+
+	editPatternProps->setText( tr("Properties..."));
+
+	//Stroke tab
+	tabFillStroke->setTabText(1, tr("Stroke"));
+	strokeModeLabel->setText( tr("Stroke Mode"));
+
+	oldIndex = strokeModeCombo->currentIndex();
+	strokeModeCombo->clear();
+	strokeModeCombo->addItem( tr("Solid"));
+	strokeModeCombo->addItem( tr("Gradient"));
+	strokeModeCombo->setCurrentIndex(oldIndex);
+
+	strokeShadeLabel->setText( tr("Shade:"));
+
+	oldIndex = gradientTypeStroke->currentIndex();
+	gradientTypeStroke->clear();
+	gradientTypeStroke->addItem( tr("Linear"));
+	gradientTypeStroke->addItem( tr("Radial"));
+	gradientTypeStroke->setCurrentIndex(oldIndex);
+
+	gradEditButtonStroke->setText( tr("Move Vector"));
+	GradientExtendSLabel->setText( tr("Extend:"));
+
+	oldIndex = GradientExtendS->currentIndex();
+	GradientExtendS->clear();
+	GradientExtendS->addItem( tr("None"));
+	GradientExtendS->addItem( tr("Pad"));
+	GradientExtendS->setCurrentIndex(oldIndex);
+
+	editPatternPropsStroke->setText( tr("Properties..."));
+	followsPath->setText( tr("Pattern follows Path"));
+
+	//Outside of tabs
+	overPrintLabel->setText( tr("Overprinting"));
+
+	oldIndex = overPrintCombo->currentIndex();
+	overPrintCombo->clear();
+	overPrintCombo->addItem( tr("Knockout"));
+	overPrintCombo->addItem( tr("Overprint"));
+	overPrintCombo->setCurrentIndex(oldIndex);
+
+	displayAllColors->setText( tr("Display only used colors"));
+}
diff --git a/scribus/ui/colorpalette.ui b/scribus/ui/colorpalette.ui
--- a/scribus/ui/colorpalette.ui
+++ b/scribus/ui/colorpalette.ui
@@ -100,7 +100,7 @@
            <item>
             <layout class="QHBoxLayout" name="horizontalLayout_3">
              <item>
-              <widget class="QLabel" name="label">
+              <widget class="QLabel" name="fillShadeLabel">
                <property name="text">
                 <string>Shade:</string>
                </property>
@@ -222,7 +222,7 @@
                <item>
                 <layout class="QHBoxLayout" name="horizontalLayout_10">
                  <item>
-                  <widget class="QLabel" name="label_14">
+                  <widget class="QLabel" name="gradientExtendLabel">
                    <property name="text">
                     <string>Extend:</string>
                    </property>
@@ -263,7 +263,7 @@
                <item>
                 <layout class="QGridLayout" name="gridLayout_4">
                  <item row="0" column="0">
-                  <widget class="QLabel" name="label_5">
+                  <widget class="QLabel" name="colorPointLabel">
                    <property name="text">
                     <string>Color</string>
                    </property>
@@ -270,7 +270,7 @@
                   </widget>
                  </item>
                  <item row="0" column="1">
-                  <widget class="QLabel" name="label_2">
+                  <widget class="QLabel" name="colorShadeLabel">
                    <property name="text">
                     <string>Shade</string>
                    </property>
@@ -277,7 +277,7 @@
                   </widget>
                  </item>
                  <item row="0" column="2">
-                  <widget class="QLabel" name="label_9">
+                  <widget class="QLabel" name="colorAlphaLabel">
                    <property name="text">
                     <string>Transparency</string>
                    </property>
@@ -485,7 +485,7 @@
                <item>
                 <layout class="QGridLayout" name="gridLayout_5">
                  <item row="0" column="0">
-                  <widget class="QLabel" name="label_3">
+                  <widget class="QLabel" name="colorMeshPointLabel">
                    <property name="text">
                     <string>Color:</string>
                    </property>
@@ -505,7 +505,7 @@
                   </widget>
                  </item>
                  <item row="1" column="0">
-                  <widget class="QLabel" name="label_4">
+                  <widget class="QLabel" name="shadeMeshPointLabel">
                    <property name="text">
                     <string>Shade:</string>
                    </property>
@@ -534,7 +534,7 @@
                   </widget>
                  </item>
                  <item row="2" column="0">
-                  <widget class="QLabel" name="label_6">
+                  <widget class="QLabel" name="transparencyMeshPointLabel">
                    <property name="text">
                     <string>Opacity:</string>
                    </property>
@@ -612,7 +612,7 @@
            <item>
             <layout class="QGridLayout" name="gridLayout">
              <item row="0" column="0">
-              <widget class="QLabel" name="label_8">
+              <widget class="QLabel" name="hatchDistLabel">
                <property name="text">
                 <string>Distance:</string>
                </property>
@@ -622,7 +622,7 @@
               <widget class="ScrSpinBox" name="hatchDist"/>
              </item>
              <item row="1" column="0">
-              <widget class="QLabel" name="label_10">
+              <widget class="QLabel" name="hatchAngleLabel">
                <property name="text">
                 <string>Angle:</string>
                </property>
@@ -632,7 +632,7 @@
               <widget class="ScrSpinBox" name="hatchAngle"/>
              </item>
              <item row="2" column="0">
-              <widget class="QLabel" name="label_11">
+              <widget class="QLabel" name="hatchTypeLabel">
                <property name="text">
                 <string>Type:</string>
                </property>
@@ -658,7 +658,7 @@
               </widget>
              </item>
              <item row="3" column="0">
-              <widget class="QLabel" name="label_12">
+              <widget class="QLabel" name="hatchLineColorLabel">
                <property name="text">
                 <string>Line Color:</string>
                </property>
@@ -668,9 +668,9 @@
               <widget class="ColorCombo" name="hatchLineColor"/>
              </item>
              <item row="4" column="0">
-              <widget class="QLabel" name="label_13">
+              <widget class="QLabel" name="hatchBackgroundLabel">
                <property name="text">
-                <string>Background</string>
+                <string>Background:</string>
                </property>
               </widget>
              </item>
@@ -835,7 +835,7 @@
            <item>
             <layout class="QHBoxLayout" name="horizontalLayout_7">
              <item>
-              <widget class="QLabel" name="label_7">
+              <widget class="QLabel" name="strokeShadeLabel">
                <property name="text">
                 <string>Shade:</string>
                </property>
@@ -910,7 +910,7 @@
            <item>
             <layout class="QHBoxLayout" name="horizontalLayout_12">
              <item>
-              <widget class="QLabel" name="label_15">
+              <widget class="QLabel" name="GradientExtendSLabel">
                <property name="text">
                 <string>Extend:</string>
                </property>
@@ -1021,7 +1021,7 @@
    <item>
     <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
-      <widget class="QLabel" name="overprintLabel">
+      <widget class="QLabel" name="overPrintLabel">
        <property name="text">
         <string>Overprinting</string>
        </property>
13379-Patch.diff (10,448 bytes)   

jghali

2015-09-28 21:41

administrator   ~0036438

Fyi the class generated by uic has a retranslateUi() method. We should better try to use it when possible as using same strings in cpp file has two drawbacks:
- may duplicate strings in ts file
- will sooner or later cause consistency problems

FirasH

2015-09-28 21:54

developer   ~0036439

Yes, that was an issue I was afraid of, strings that may be inconsistent even if duplicates. If there is a standard method to dynamically update strings inside of tr() and .ui files that would help a lot, need to check Qt docs. That would as well reduce the number of strings in .ts files, as many dialogs use this kind of hybrid translation/update.

jghali

2015-10-04 14:51

administrator   ~0036505

I applied your patch and rewrote languageChange() by using Ui::colorPalette 's retranslateUi().

FirasH

2015-10-04 18:07

developer   ~0036508

Thanks jghali! This solution is much better!
Fixed in 1.5.1.svn (20443).

Issue History

Date Modified Username Field Change
2015-09-28 11:34 FirasH New Issue
2015-09-28 11:34 FirasH File Added: 13379-Patch.diff
2015-09-28 11:39 FirasH File Deleted: 13379-Patch.diff
2015-09-28 11:39 FirasH File Added: 13379-Patch.diff
2015-09-28 21:41 jghali Note Added: 0036438
2015-09-28 21:54 FirasH Note Added: 0036439
2015-10-04 14:51 jghali Note Added: 0036505
2015-10-04 14:51 jghali Status new => resolved
2015-10-04 14:51 jghali Fixed in Version => 1.5.1svn
2015-10-04 14:51 jghali Resolution open => fixed
2015-10-04 14:51 jghali Assigned To => FirasH
2015-10-04 18:07 FirasH Note Added: 0036508
2015-10-04 18:07 FirasH Status resolved => closed