@@ -52,6 +52,7 @@ const char* SettingName(OptionsModel::OptionID option)
52
52
case OptionsModel::ProxyIPTor: return " onion" ;
53
53
case OptionsModel::ProxyPortTor: return " onion" ;
54
54
case OptionsModel::ProxyUseTor: return " onion" ;
55
+ case OptionsModel::Language: return " lang" ;
55
56
default : throw std::logic_error (strprintf (" GUI option %i has no corresponding node setting." , option));
56
57
};
57
58
}
@@ -132,6 +133,7 @@ bool OptionsModel::Init(bilingual_str& error)
132
133
ProxySetting onion = ParseProxyString (SettingToString (node ().getPersistentSetting (" onion" ), GetDefaultProxyAddress ().toStdString ()));
133
134
m_onion_ip = onion.ip ;
134
135
m_onion_port = onion.port ;
136
+ language = QString::fromStdString (SettingToString (node ().getPersistentSetting (" lang" ), " " ));
135
137
136
138
checkAndMigrate ();
137
139
@@ -185,7 +187,7 @@ bool OptionsModel::Init(bilingual_str& error)
185
187
// These are shared with the core or have a command-line parameter
186
188
// and we want command-line parameters to overwrite the GUI settings.
187
189
for (OptionID option : {DatabaseCache, ThreadsScriptVerif, SpendZeroConfChange, ExternalSignerPath, MapPortUPnP,
188
- MapPortNatpmp, Listen, Server, Prune, ProxyUse, ProxyUseTor}) {
190
+ MapPortNatpmp, Listen, Server, Prune, ProxyUse, ProxyUseTor, Language }) {
189
191
std::string setting = SettingName (option);
190
192
if (node ().isSettingIgnored (setting)) addOverriddenOption (" -" + setting);
191
193
try {
@@ -199,9 +201,6 @@ bool OptionsModel::Init(bilingual_str& error)
199
201
}
200
202
201
203
// If setting doesn't exist create it with defaults.
202
- //
203
- // If gArgs.SoftSetArg() or gArgs.SoftSetBoolArg() return false we were overridden
204
- // by command-line and show this in the UI.
205
204
206
205
// Main
207
206
if (!settings.contains (" strDataDir" ))
@@ -216,13 +215,6 @@ bool OptionsModel::Init(bilingual_str& error)
216
215
#endif
217
216
218
217
// Display
219
- if (!settings.contains (" language" ))
220
- settings.setValue (" language" , " " );
221
- if (!gArgs .SoftSetArg (" -lang" , settings.value (" language" ).toString ().toStdString ()))
222
- addOverriddenOption (" -lang" );
223
-
224
- language = settings.value (" language" ).toString ();
225
-
226
218
if (!settings.contains (" UseEmbeddedMonospacedFont" )) {
227
219
settings.setValue (" UseEmbeddedMonospacedFont" , " true" );
228
220
}
@@ -415,7 +407,7 @@ QVariant OptionsModel::getOption(OptionID option) const
415
407
case ThirdPartyTxUrls:
416
408
return strThirdPartyTxUrls;
417
409
case Language:
418
- return settings. value ( " language " );
410
+ return QString::fromStdString ( SettingToString ( setting (), " " ) );
419
411
case UseEmbeddedMonospacedFont:
420
412
return m_use_embedded_monospaced_font;
421
413
case CoinControlFeatures:
@@ -558,8 +550,8 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value)
558
550
}
559
551
break ;
560
552
case Language:
561
- if (settings. value ( " language " ) != value ) {
562
- settings. setValue ( " language " , value);
553
+ if (changed () ) {
554
+ update ( value. toString (). toStdString () );
563
555
setRestartRequired (true );
564
556
}
565
557
break ;
@@ -710,6 +702,7 @@ void OptionsModel::checkAndMigrate()
710
702
migrate_setting (ProxyUse, " fUseProxy" );
711
703
migrate_setting (ProxyIPTor, " addrSeparateProxyTor" );
712
704
migrate_setting (ProxyUseTor, " fUseSeparateProxyTor" );
705
+ migrate_setting (Language, " language" );
713
706
714
707
// In case migrating QSettings caused any settings value to change, rerun
715
708
// parameter interaction code to update other settings. This is particularly
0 commit comments