Skip to content

Localize Debug Settings comments (PT-BR) with English fallback#5956

Open
vedned wants to merge 2 commits into
secondlife:developfrom
vedned:Add-localized-Debug-Settings
Open

Localize Debug Settings comments (PT-BR) with English fallback#5956
vedned wants to merge 2 commits into
secondlife:developfrom
vedned:Add-localized-Debug-Settings

Conversation

@vedned

@vedned vedned commented Jun 25, 2026

Copy link
Copy Markdown

Description

The Debug Settings panel (Advanced → Show Debug Settings) shows a help comment for each setting. Until now these comments were always displayed in English, regardless of the language selected in the viewer, because they are read directly from app_settings/settings.xml at runtime. This made advanced configuration harder for non-English speakers.

This PR introduces localized Debug Settings comments: when a translation file exists for the active language, the viewer displays the setting descriptions in that language. When it does not, the previous behavior (English) is fully preserved. It also ships a complete PT-BR translation as the first implementation.

What changes

After the session language is initialized, the viewer loads skins/default/xui/{locale}/settings_comments.xml and overrides the comments of the existing controls at runtime, for both the Global and PerAccount settings groups.

Implementation

  • Added LLAppViewer::loadLocalizedSettingsComments() and a helper apply_localized_comments() in indra/newview/llappviewer.cpp.
  • Declared the new method in indra/newview/llappviewer.h.
  • The call is placed right after the skin/language is set, so LLUI::getLanguage() is already valid and the default English comments have already been loaded.
  • The localized file is located with gDirUtilp->findSkinnedFilename(LLDir::XUI, "settings_comments.xml", LLDir::CURRENT_SKIN), which returns the most-localized existing path, or an empty string when none exists.
  • The file is parsed with LLSDSerialize::fromXML into a simple LLSD map (SettingName -> "translated comment"), and each entry overrides the comment of the matching control via LLControlVariable::setComment().

Why it is safe

  • getControl() returns an LLControlVariablePtr (smart pointer); the helper checks notNull() before writing.
  • Controls and default English comments are loaded earlier in initConfiguration() via loadSettingsFromDirectory("Default", set_defaults=true), before this call.
  • The post-login account settings load uses set_defaults=false, which does not call setComment(), so translated comments are not overwritten later.
  • No new includes were required (llsdserialize.h and llviewercontrol.h already included).

Fallback behavior

  1. No file for the locale → the whole language keeps the English comments.
  2. Missing key inside the file → that specific setting keeps its English comment.

PT-BR content

  • Added indra/newview/skins/default/xui/pt/settings_comments.xml covering 1,507 settings (1,466 from settings.xml + 41 from settings_per_account.xml), validated as well-formed XML, with consistent terminology across families of settings.
  • Completed the missing labels in indra/newview/skins/default/xui/pt/floater_settings_debug.xml.

Files changed

  • indra/newview/llappviewer.h
  • indra/newview/llappviewer.cpp
  • indra/newview/skins/default/xui/pt/settings_comments.xml (new)
  • indra/newview/skins/default/xui/pt/floater_settings_debug.xml

Related Issues

Issue Link: relates to #5955


Checklist

  • I have provided a clear title and detailed description for this pull request.
  • If useful, I have included media such as screenshots and video to show off my changes.
  • The PR is linked to a relevant issue with sufficient context.
  • I have tested the changes locally and verified they work as intended.
  • All new and existing tests pass.
  • Code follows the project's style guidelines.
  • Documentation has been updated if needed.
  • Any dependent changes have been merged and published in downstream modules
  • I have reviewed the contributing guidelines.

Additional Notes

Debug Settings Português:

SL1
2026-06-25.16-05-15.mp4

How to test

  1. Build and run the viewer.
  2. Set the language to Português (Brasil) and restart if prompted.
  3. Enable the Advanced menu in Preferences → Advanced → "Show Advanced Menu".
  4. Open Advanced → Show Debug Settings.
  5. Select several settings and confirm the help comments are shown in Portuguese.
  6. Switch to a language without a settings_comments.xml and confirm comments fall back to English.
  7. Confirm a setting key not present in the PT file still shows its English comment.

@github-actions github-actions Bot added the c/cpp label Jun 25, 2026
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@vedned

vedned commented Jun 25, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant