Skip to content

Commit 280b267

Browse files
committed
Update of translations
* Updated language display in preferences dialog to be more explicit * Updated translations strings
1 parent e61c01b commit 280b267

File tree

6 files changed

+590
-389
lines changed

6 files changed

+590
-389
lines changed

resources/translations/openfluid-fr_FR.ts

Lines changed: 541 additions & 370 deletions
Large diffs are not rendered by default.

src/builderexts/import.spatial-graph.ogr-gdal/import.spatial-graph.ogr-gdal-fr_FR.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -510,19 +510,19 @@ Quitter l&apos;import quand même?</translation>
510510
</message>
511511
<message>
512512
<location filename="SourceAddDialog.cpp" line="189"/>
513-
<location filename="SourceAddDialog.cpp" line="282"/>
514-
<location filename="SourceAddDialog.cpp" line="291"/>
513+
<location filename="SourceAddDialog.cpp" line="283"/>
514+
<location filename="SourceAddDialog.cpp" line="292"/>
515515
<source>Aborting.</source>
516516
<translation>Abandon.</translation>
517517
</message>
518518
<message>
519-
<location filename="SourceAddDialog.cpp" line="279"/>
520-
<location filename="SourceAddDialog.cpp" line="289"/>
519+
<location filename="SourceAddDialog.cpp" line="280"/>
520+
<location filename="SourceAddDialog.cpp" line="290"/>
521521
<source>Error importing from source</source>
522522
<translation>Erreur d&apos;&apos;import depuis la source</translation>
523523
</message>
524524
<message>
525-
<location filename="SourceAddDialog.cpp" line="281"/>
525+
<location filename="SourceAddDialog.cpp" line="282"/>
526526
<source>The mandatory field &quot;OFLD_ID&quot; cannot be found.</source>
527527
<translation>Le champ obligatoire &quot;OFLD_ID&quot; ne peut être trouvé.</translation>
528528
</message>
@@ -540,8 +540,8 @@ Abandon.</translation>
540540
<translation>%1 couche(s) disponible(s)</translation>
541541
</message>
542542
<message>
543-
<location filename="SourceAddDialog.cpp" line="278"/>
544-
<location filename="SourceAddDialog.cpp" line="288"/>
543+
<location filename="SourceAddDialog.cpp" line="279"/>
544+
<location filename="SourceAddDialog.cpp" line="289"/>
545545
<source>Import error</source>
546546
<translation>Erreur d&apos;import</translation>
547547
</message>

src/builderexts/view.spatial-graph.graphviz/view.spatial-graph.graphviz-fr_FR.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<context>
2828
<name>GraphvizViewExtension</name>
2929
<message>
30-
<location filename="GraphvizViewExtension.cpp" line="100"/>
30+
<location filename="GraphvizViewExtension.cpp" line="107"/>
3131
<source>GraphViz software (dot) cannot be found!
3232
Please make sure the dot program is accessible in the PATH
3333
and try launching this extension again.</source>
@@ -102,7 +102,7 @@ et essayez de lancer cette extension à nouveau.</translation>
102102
<context>
103103
<name>signature</name>
104104
<message>
105-
<location filename="GraphvizViewExtension.cpp" line="59"/>
105+
<location filename="GraphvizViewExtension.cpp" line="60"/>
106106
<source>Spatial graph viewer (GraphViz)</source>
107107
<translation>Visualisateur du graphe d&apos;espace (GraphViz)</translation>
108108
</message>

src/observers/export.vars.files.csv/export.vars.files.csv-fr_FR.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@
6565
<translation></translation>
6666
</message>
6767
<message>
68-
<location filename="CSVObsParamsWidget.cpp" line="459"/>
68+
<location filename="CSVObsParamsWidget.cpp" line="460"/>
6969
<source>Automatic generation</source>
7070
<translation>Génération automatique</translation>
7171
</message>
7272
<message>
73-
<location filename="CSVObsParamsWidget.cpp" line="460"/>
73+
<location filename="CSVObsParamsWidget.cpp" line="461"/>
7474
<source>A format and one or more sets configurations will be automatically generated.
7575
This will remove existing formats and sets.
7676

src/openfluid/ui/common/PreferencesDialog.cpp

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
*/
3939

4040

41+
#include <QLocale>
4142
#include <QFileDialog>
4243
#include <QMessageBox>
4344
#include <QColorDialog>
@@ -127,7 +128,7 @@ PreferencesDialog::PreferencesDialog(QWidget* Parent, DisplayMode Mode):
127128

128129
initialize();
129130

130-
connect(ui->LangComboBox,SIGNAL(currentIndexChanged(const QString&)),this,SLOT(updateLanguage(const QString&)));
131+
connect(ui->LangComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(updateLanguage(int)));
131132
connect(ui->RecentMaxSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRecentsMax(int)));
132133
connect(ui->ClearRecentsButton,SIGNAL(clicked()),this,SLOT(clearRecentsList()));
133134
connect(ui->AutoSaveCheckBox,SIGNAL(toggled(bool)),this,SLOT(enableAutoSaveBeforeRun(bool)));
@@ -208,15 +209,40 @@ PreferencesDialog::~PreferencesDialog()
208209
// =====================================================================
209210

210211

212+
QString PreferencesDialog::getLanguageAsPrettyString(const QString& LangCode)
213+
{
214+
QLocale Loc(LangCode);
215+
QString LangName;
216+
217+
if (Loc.language() == QLocale::English)
218+
LangName = QLocale::languageToString(Loc.language());
219+
else
220+
LangName = Loc.nativeLanguageName();
221+
222+
LangName[0] = LangName[0].toUpper();
223+
QString CountryName = Loc.nativeCountryName();
224+
225+
return QString("%1 (%2)").arg(LangName).arg(Loc.nativeCountryName());
226+
}
227+
228+
229+
// =====================================================================
230+
// =====================================================================
231+
232+
211233
void PreferencesDialog::initialize()
212234
{
213235
openfluid::base::PreferencesManager* PrefsMan = openfluid::base::PreferencesManager::instance();
214236

215-
// Interface
216-
// TODO set up a fancier languages list
217-
ui->LangComboBox->addItem("default");
218-
ui->LangComboBox->addItems(openfluid::base::PreferencesManager::getAvailableLangs());
219-
ui->LangComboBox->setCurrentIndex(ui->LangComboBox->findText(PrefsMan->getLang()));
237+
// Interface language
238+
QStringList AvailLangCodes = openfluid::base::PreferencesManager::getAvailableLangs();
239+
240+
ui->LangComboBox->addItem(getLanguageAsPrettyString("en_GB"),"default");
241+
for (auto Code : AvailLangCodes)
242+
{
243+
ui->LangComboBox->addItem(getLanguageAsPrettyString(Code),Code);
244+
}
245+
ui->LangComboBox->setCurrentIndex(ui->LangComboBox->findData(PrefsMan->getLang()));
220246

221247
m_OriginalLangIndex = ui->LangComboBox->currentIndex();
222248

@@ -298,8 +324,10 @@ void PreferencesDialog::changePage(QTreeWidgetItem* Current, QTreeWidgetItem* Pr
298324
// =====================================================================
299325

300326

301-
void PreferencesDialog::updateLanguage(const QString& Lang)
327+
void PreferencesDialog::updateLanguage(int Index)
302328
{
329+
QString Lang = ui->LangComboBox->itemData(Index).toString();
330+
303331
openfluid::base::PreferencesManager::instance()->setLang(Lang);
304332

305333
updateRestartStatus();

src/openfluid/ui/common/PreferencesDialog.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class OPENFLUID_API PreferencesDialog : public OpenFLUIDDialog
8686

8787
void changePage(QTreeWidgetItem* Current, QTreeWidgetItem* Previous);
8888

89-
void updateLanguage(const QString& Lang);
89+
void updateLanguage(int Index);
9090

9191
void clearRecentsList();
9292

@@ -197,6 +197,8 @@ class OPENFLUID_API PreferencesDialog : public OpenFLUIDDialog
197197

198198
void updateRestartStatus();
199199

200+
static QString getLanguageAsPrettyString(const QString& LangCode);
201+
200202

201203
signals:
202204

0 commit comments

Comments
 (0)