diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-02-15 20:41:03 +0200 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-02-15 20:41:03 +0200 |
commit | 0c8d51b8c8bdca567e349755393c57cd113a81f0 (patch) | |
tree | ceb761a50d45d88f1d8f5d9db708e7dfaac1f3fb | |
parent | fddfe50ac125c1b25592ce30dbbb34363047cea1 (diff) |
SL-10234 Fixed The viewer shows installation language as system default
17 files changed, 154 insertions, 20 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 00a933a0bb..b2ad38bddf 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -243,7 +243,14 @@ LLScrollListItem* LLComboBox::add(const std::string& name, EAddPosition pos, BOO item->setEnabled(enabled); if (!mAllowTextEntry && mLabel.empty()) { - selectFirstItem(); + if (mControlVariable) + { + setValue(mControlVariable->getValue()); // selects the appropriate item + } + else + { + selectFirstItem(); + } } return item; } @@ -255,7 +262,14 @@ LLScrollListItem* LLComboBox::add(const std::string& name, const LLUUID& id, EAd item->setEnabled(enabled); if (!mAllowTextEntry && mLabel.empty()) { - selectFirstItem(); + if (mControlVariable) + { + setValue(mControlVariable->getValue()); // selects the appropriate item + } + else + { + selectFirstItem(); + } } return item; } @@ -268,7 +282,14 @@ LLScrollListItem* LLComboBox::add(const std::string& name, void* userdata, EAddP item->setUserdata( userdata ); if (!mAllowTextEntry && mLabel.empty()) { - selectFirstItem(); + if (mControlVariable) + { + setValue(mControlVariable->getValue()); // selects the appropriate item + } + else + { + selectFirstItem(); + } } return item; } @@ -280,7 +301,14 @@ LLScrollListItem* LLComboBox::add(const std::string& name, LLSD value, EAddPosit item->setEnabled(enabled); if (!mAllowTextEntry && mLabel.empty()) { - selectFirstItem(); + if (mControlVariable) + { + setValue(mControlVariable->getValue()); // selects the appropriate item + } + else + { + selectFirstItem(); + } } return item; } diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index a8019ee168..60c27665bf 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1587,6 +1587,7 @@ endif (WINDOWS) # from within the IDE. set(viewer_XUI_FILES skins/default/colors.xml + skins/default/default_languages.xml skins/default/textures/textures.xml ) file(GLOB DEFAULT_XUI_FILE_GLOB_LIST diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index c3dea73c05..a3821ef21a 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -138,6 +138,25 @@ static const F32 MIN_ARC_LOG = log(MIN_ARC_LIMIT); static const F32 MAX_ARC_LOG = log(MAX_ARC_LIMIT); static const F32 ARC_LIMIT_MAP_SCALE = (MAX_ARC_LOG - MIN_ARC_LOG) / (MAX_INDIRECT_ARC_LIMIT - MIN_INDIRECT_ARC_LIMIT); +struct LabelDef : public LLInitParam::Block<LabelDef> +{ + Mandatory<std::string> name; + Mandatory<std::string> value; + + LabelDef() + : name("name"), + value("value") + {} +}; + +struct LabelTable : public LLInitParam::Block<LabelTable> +{ + Multiple<LabelDef> labels; + LabelTable() + : labels("label") + {} +}; + class LLVoiceSetKeyDialog : public LLModalDialog { public: @@ -514,6 +533,29 @@ BOOL LLFloaterPreference::postBuild() mFilterEdit = getChild<LLSearchEditor>("search_prefs_edit"); mFilterEdit->setKeystrokeCallback(boost::bind(&LLFloaterPreference::onUpdateFilterTerm, this, false)); + // Load and assign label for 'default language' + std::string user_filename = gDirUtilp->getExpandedFilename(LL_PATH_DEFAULT_SKIN, "default_languages.xml"); + std::map<std::string, std::string> labels; + if (loadFromFilename(user_filename, labels)) + { + std::string system_lang = gSavedSettings.getString("SystemLanguage"); + std::map<std::string, std::string>::iterator iter = labels.find(system_lang); + if (iter != labels.end()) + { + getChild<LLComboBox>("language_combobox")->add(iter->second, LLSD("default"), ADD_TOP, true); + } + else + { + LL_WARNS() << "Language \"" << system_lang << "\" is not in default_languages.xml" << LL_ENDL; + getChild<LLComboBox>("language_combobox")->add("System default", LLSD("default"), ADD_TOP, true); + } + } + else + { + LL_WARNS() << "Failed to load labels from " << user_filename << ". Using default." << LL_ENDL; + getChild<LLComboBox>("language_combobox")->add("System default", LLSD("default"), ADD_TOP, true); + } + return TRUE; } @@ -1979,6 +2021,45 @@ void LLFloaterPreference::updateMaxComplexity() getChild<LLTextBox>("IndirectMaxComplexityText")); } +bool LLFloaterPreference::loadFromFilename(const std::string& filename, std::map<std::string, std::string> &label_map) +{ + LLXMLNodePtr root; + + if (!LLXMLNode::parseFile(filename, root, NULL)) + { + LL_WARNS() << "Unable to parse file " << filename << LL_ENDL; + return false; + } + + if (!root->hasName("labels")) + { + LL_WARNS() << filename << " is not a valid definition file" << LL_ENDL; + return false; + } + + LabelTable params; + LLXUIParser parser; + parser.readXUI(root, params, filename); + + if (params.validateBlock()) + { + for (LLInitParam::ParamIterator<LabelDef>::const_iterator it = params.labels.begin(); + it != params.labels.end(); + ++it) + { + LabelDef label_entry = *it; + label_map[label_entry.name] = label_entry.value; + } + } + else + { + LL_WARNS() << filename << " failed to load" << LL_ENDL; + return false; + } + + return true; +} + void LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity() { // Called when the IndirectMaxComplexity control changes diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index d609c42ebe..1b8229ada6 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -198,6 +198,7 @@ private: void onDeleteTranscriptsResponse(const LLSD& notification, const LLSD& response); void updateDeleteTranscriptsButton(); void updateMaxComplexity(); + static bool loadFromFilename(const std::string& filename, std::map<std::string, std::string> &label_map); static std::string sSkin; notifications_map mNotificationOptions; diff --git a/indra/newview/skins/default/default_languages.xml b/indra/newview/skins/default/default_languages.xml new file mode 100644 index 0000000000..357930e1c5 --- /dev/null +++ b/indra/newview/skins/default/default_languages.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<labels> + <label + name="en" + value="System default" /> + <label + name="it" + value="Default di sistema" /> + <label + name="ja" + value="システムデフォルト" /> + <label + name="pl" + value="Domyślny" /> + <label + name="pt" + value="Padrão" /> + <label + name="ru" + value="Язык системы" /> + <label + name="tr" + value="Sistem varsayılanı" /> + <label + name="zh" + value="系統預設" /> + <label + name="da" + value="System standard" /> + <label + name="de" + value="Systemvorgabe" /> + <label + name="es" + value="Predeterminado del sistema" /> + <label + name="fr" + value="Choix par défaut" /> +</labels> diff --git a/indra/newview/skins/default/xui/da/panel_preferences_general.xml b/indra/newview/skins/default/xui/da/panel_preferences_general.xml index 5702d48e97..624c6634cc 100644 --- a/indra/newview/skins/default/xui/da/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/da/panel_preferences_general.xml @@ -4,7 +4,6 @@ Sprog: </text> <combo_box name="language_combobox"> - <combo_box.item label="System standard" name="System Default Language"/> <combo_box.item label="English (Engelsk)" name="English"/> <combo_box.item label="Dansk - Beta" name="Danish"/> <combo_box.item label="Deutsch (Tysk) - Beta" name="Deutsch(German)"/> diff --git a/indra/newview/skins/default/xui/de/panel_preferences_general.xml b/indra/newview/skins/default/xui/de/panel_preferences_general.xml index 201998f220..c4705d7283 100644 --- a/indra/newview/skins/default/xui/de/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/de/panel_preferences_general.xml @@ -4,7 +4,6 @@ Sprache: </text> <combo_box name="language_combobox"> - <combo_box.item label="Systemvorgabe" name="System Default Language"/> <combo_box.item label="English (Englisch)" name="English"/> <combo_box.item label="Dansk (Dänisch) - Beta" name="Danish"/> <combo_box.item label="Deutsch - Beta" name="Deutsch(German)"/> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml index 9da044ab64..335d7caa51 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml @@ -32,11 +32,6 @@ width="200"> <combo_box.item enabled="true" - label="System default" - name="System Default Language" - value="default" /> - <combo_box.item - enabled="true" label="English" name="English" value="en" /> diff --git a/indra/newview/skins/default/xui/es/panel_preferences_general.xml b/indra/newview/skins/default/xui/es/panel_preferences_general.xml index 7d3c33a781..d2246630d8 100644 --- a/indra/newview/skins/default/xui/es/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/es/panel_preferences_general.xml @@ -4,7 +4,6 @@ Idioma: </text> <combo_box name="language_combobox"> - <combo_box.item label="Predeterminado del sistema" name="System Default Language"/> <combo_box.item label="English (Inglés)" name="English"/> <combo_box.item label="Dansk (danés) - Beta" name="Danish"/> <combo_box.item label="Deutsch (Alemán) - Beta" name="Deutsch(German)"/> diff --git a/indra/newview/skins/default/xui/fr/panel_preferences_general.xml b/indra/newview/skins/default/xui/fr/panel_preferences_general.xml index 11b1bd9b87..b75567a40f 100644 --- a/indra/newview/skins/default/xui/fr/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/fr/panel_preferences_general.xml @@ -4,7 +4,6 @@ Langue : </text> <combo_box name="language_combobox"> - <combo_box.item label="Choix par défaut" name="System Default Language"/> <combo_box.item label="English (Anglais)" name="English"/> <combo_box.item label="Dansk (Danois) - Bêta" name="Danish"/> <combo_box.item label="Deutsch (Allemand) - Bêta" name="Deutsch(German)"/> diff --git a/indra/newview/skins/default/xui/it/panel_preferences_general.xml b/indra/newview/skins/default/xui/it/panel_preferences_general.xml index ef999d03c0..49edc0aa12 100644 --- a/indra/newview/skins/default/xui/it/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/it/panel_preferences_general.xml @@ -4,7 +4,6 @@ Lingua: </text> <combo_box name="language_combobox"> - <combo_box.item label="Default di sistema" name="System Default Language"/> <combo_box.item label="English" name="English"/> <combo_box.item label="Dansk (Danese) - Beta" name="Danish"/> <combo_box.item label="Deutsch (Tedesco) - Beta" name="Deutsch(German)"/> diff --git a/indra/newview/skins/default/xui/ja/panel_preferences_general.xml b/indra/newview/skins/default/xui/ja/panel_preferences_general.xml index e2b74354fa..378cf8652e 100644 --- a/indra/newview/skins/default/xui/ja/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/ja/panel_preferences_general.xml @@ -4,7 +4,6 @@ 言語: </text> <combo_box name="language_combobox"> - <combo_box.item label="システムデフォルト" name="System Default Language"/> <combo_box.item label="English (英語)" name="English"/> <combo_box.item label="Dansk (デンマーク語) - ベータ" name="Danish"/> <combo_box.item label="Deutsch (ドイツ語) – ベータ" name="Deutsch(German)"/> diff --git a/indra/newview/skins/default/xui/pl/panel_preferences_general.xml b/indra/newview/skins/default/xui/pl/panel_preferences_general.xml index 082dc0687e..55df13e7ac 100644 --- a/indra/newview/skins/default/xui/pl/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/pl/panel_preferences_general.xml @@ -4,7 +4,6 @@ Język: </text> <combo_box name="language_combobox"> - <combo_box.item label="Domyślny" name="System Default Language" /> <combo_box.item label="English (Angielski)" name="English" /> <combo_box.item label="Dansk (Duński) - Beta" name="Danish" /> <combo_box.item label="Deutsch (Niemiecki) - Beta" name="Deutsch(German)" /> diff --git a/indra/newview/skins/default/xui/pt/panel_preferences_general.xml b/indra/newview/skins/default/xui/pt/panel_preferences_general.xml index 68fbd049b1..915d695605 100644 --- a/indra/newview/skins/default/xui/pt/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/pt/panel_preferences_general.xml @@ -4,7 +4,6 @@ Idioma: </text> <combo_box name="language_combobox"> - <combo_box.item label="Padrão" name="System Default Language"/> <combo_box.item label="English (Inglês)" name="English"/> <combo_box.item label="Dansk (Dinamarquês) - Beta" name="Danish"/> <combo_box.item label="Deutsch (Alemão) - Beta" name="Deutsch(German)"/> diff --git a/indra/newview/skins/default/xui/ru/panel_preferences_general.xml b/indra/newview/skins/default/xui/ru/panel_preferences_general.xml index b15d0e3abf..918b042dd7 100644 --- a/indra/newview/skins/default/xui/ru/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/ru/panel_preferences_general.xml @@ -4,7 +4,6 @@ Язык: </text> <combo_box name="language_combobox"> - <combo_box.item label="Язык системы" name="System Default Language"/> <combo_box.item label="English - Английский" name="English"/> <combo_box.item label="Dansk – датский (бета-версия)" name="Danish"/> <combo_box.item label="Deutsch – немецкий (бета-версия)" name="Deutsch(German)"/> diff --git a/indra/newview/skins/default/xui/tr/panel_preferences_general.xml b/indra/newview/skins/default/xui/tr/panel_preferences_general.xml index 2c05e8a47a..cec7a67f2f 100644 --- a/indra/newview/skins/default/xui/tr/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/tr/panel_preferences_general.xml @@ -4,7 +4,6 @@ Dil: </text> <combo_box name="language_combobox"> - <combo_box.item label="Sistem varsayılanı" name="System Default Language"/> <combo_box.item label="English (İngilizce)" name="English"/> <combo_box.item label="Dansk (Danca) - Beta" name="Danish"/> <combo_box.item label="Deutsch (Almanca) - Beta" name="Deutsch(German)"/> diff --git a/indra/newview/skins/default/xui/zh/panel_preferences_general.xml b/indra/newview/skins/default/xui/zh/panel_preferences_general.xml index 20335d82ae..87c38e4346 100644 --- a/indra/newview/skins/default/xui/zh/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/zh/panel_preferences_general.xml @@ -4,7 +4,6 @@ 語言: </text> <combo_box name="language_combobox"> - <combo_box.item label="系統預設" name="System Default Language"/> <combo_box.item label="英語" name="English"/> <combo_box.item label="Dansk(丹麥語)- 試用版" name="Danish"/> <combo_box.item label="Deutsch(德語)- 試用版" name="Deutsch(German)"/> |