diff options
| author | Andrey Lihatskiy <118752495+marchcat@users.noreply.github.com> | 2026-07-07 17:28:43 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-07 17:28:43 +0300 |
| commit | 854ac889cd51694754da408271d0a2fa5c070b31 (patch) | |
| tree | 29ef6bf027fb90f408835b1696d3dcc4bdf1dd46 /indra/newview/llappviewer.cpp | |
| parent | 5be07501b638c97150520afe217e460a2159e49e (diff) | |
| parent | 45fc31ba7b74a2c87690145fa163dab3f197b3a6 (diff) | |
Merge pull request #5956 from vedned/Add-localized-Debug-Settings
Localize Debug Settings comments (PT-BR) with English fallback
Diffstat (limited to 'indra/newview/llappviewer.cpp')
| -rw-r--r-- | indra/newview/llappviewer.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 58e3aea9b7..b0c13d9818 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -855,6 +855,8 @@ bool LLAppViewer::init() // that use findSkinnedFilenames(), will include the localized files. gDirUtilp->setSkinFolder(gDirUtilp->getSkinFolder(), LLUI::getLanguage()); + loadLocalizedSettingsComments(); + // Setup LLTrans after LLUI::initClass has been called. initStrings(); @@ -3135,6 +3137,57 @@ bool LLAppViewer::initConfiguration() return true; // Config was successful. } +static void apply_localized_comments(LLControlGroup& group, const LLSD& comments) +{ + for (LLSD::map_const_iterator it = comments.beginMap(); it != comments.endMap(); ++it) + { + LLControlVariablePtr control = group.getControl(it->first); + if (control.notNull()) + { + const std::string comment = it->second.asString(); + if (!comment.empty()) + { + control->setComment(comment); + } + } + } +} + +void LLAppViewer::loadLocalizedSettingsComments() +{ + std::string lang = LLUI::getLanguage(); + if (lang.empty() || lang == "en") + { + return; + } + + std::string path = gDirUtilp->findSkinnedFilename( + LLDir::XUI, "settings_comments.xml", LLDir::CURRENT_SKIN); + if (path.empty()) + { + return; + } + + llifstream infile; + infile.open(path.c_str()); + if (!infile.is_open()) + { + return; + } + + LLSD comments; + if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(comments, infile)) + { + infile.close(); + LL_WARNS("Settings") << "Failed to parse localized settings comments file: " << path << LL_ENDL; + return; + } + infile.close(); + + apply_localized_comments(gSavedSettings, comments); + apply_localized_comments(gSavedPerAccountSettings, comments); +} + // The following logic is replicated in initConfiguration() (to be able to get // some initial strings before we've finished initializing enough to know the // current language) and also in init() (to initialize for real). Somehow it |
