@@ -53,6 +53,7 @@ static const char* SettingName(OptionsModel::OptionID option)
5353 case OptionsModel::ProxyIPTor: return " onion" ;
5454 case OptionsModel::ProxyPortTor: return " onion" ;
5555 case OptionsModel::ProxyUseTor: return " onion" ;
56+ case OptionsModel::Language: return " lang" ;
5657 default : throw std::logic_error (strprintf (" GUI option %i has no corresponding node setting." , option));
5758 }
5859}
@@ -137,6 +138,7 @@ bool OptionsModel::Init(bilingual_str& error)
137138 ProxySetting onion = ParseProxyString (SettingToString (node ().getPersistentSetting (" onion" ), GetDefaultProxyAddress ().toStdString ()));
138139 m_onion_ip = onion.ip ;
139140 m_onion_port = onion.port ;
141+ language = QString::fromStdString (SettingToString (node ().getPersistentSetting (" lang" ), " " ));
140142
141143 checkAndMigrate ();
142144
@@ -190,7 +192,7 @@ bool OptionsModel::Init(bilingual_str& error)
190192 // These are shared with the core or have a command-line parameter
191193 // and we want command-line parameters to overwrite the GUI settings.
192194 for (OptionID option : {DatabaseCache, ThreadsScriptVerif, SpendZeroConfChange, ExternalSignerPath, MapPortUPnP,
193- MapPortNatpmp, Listen, Server, Prune, ProxyUse, ProxyUseTor}) {
195+ MapPortNatpmp, Listen, Server, Prune, ProxyUse, ProxyUseTor, Language }) {
194196 std::string setting = SettingName (option);
195197 if (node ().isSettingIgnored (setting)) addOverriddenOption (" -" + setting);
196198 try {
@@ -205,9 +207,6 @@ bool OptionsModel::Init(bilingual_str& error)
205207 }
206208
207209 // If setting doesn't exist create it with defaults.
208- //
209- // If gArgs.SoftSetArg() or gArgs.SoftSetBoolArg() return false we were overridden
210- // by command-line and show this in the UI.
211210
212211 // Main
213212 if (!settings.contains (" strDataDir" ))
@@ -222,13 +221,6 @@ bool OptionsModel::Init(bilingual_str& error)
222221#endif
223222
224223 // Display
225- if (!settings.contains (" language" ))
226- settings.setValue (" language" , " " );
227- if (!gArgs .SoftSetArg (" -lang" , settings.value (" language" ).toString ().toStdString ()))
228- addOverriddenOption (" -lang" );
229-
230- language = settings.value (" language" ).toString ();
231-
232224 if (!settings.contains (" UseEmbeddedMonospacedFont" )) {
233225 settings.setValue (" UseEmbeddedMonospacedFont" , " true" );
234226 }
@@ -421,7 +413,7 @@ QVariant OptionsModel::getOption(OptionID option) const
421413 case ThirdPartyTxUrls:
422414 return strThirdPartyTxUrls;
423415 case Language:
424- return settings. value ( " language " );
416+ return QString::fromStdString ( SettingToString ( setting (), " " ) );
425417 case UseEmbeddedMonospacedFont:
426418 return m_use_embedded_monospaced_font;
427419 case CoinControlFeatures:
@@ -564,8 +556,8 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value)
564556 }
565557 break ;
566558 case Language:
567- if (settings. value ( " language " ) != value ) {
568- settings. setValue ( " language " , value);
559+ if (changed () ) {
560+ update ( value. toString (). toStdString () );
569561 setRestartRequired (true );
570562 }
571563 break ;
@@ -711,6 +703,7 @@ void OptionsModel::checkAndMigrate()
711703 migrate_setting (ProxyUse, " fUseProxy" );
712704 migrate_setting (ProxyIPTor, " addrSeparateProxyTor" );
713705 migrate_setting (ProxyUseTor, " fUseSeparateProxyTor" );
706+ migrate_setting (Language, " language" );
714707
715708 // In case migrating QSettings caused any settings value to change, rerun
716709 // parameter interaction code to update other settings. This is particularly
0 commit comments