Skip to content

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

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

Localize Debug Settings comments (PT-BR) with English fallback#5956
vedned wants to merge 3 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds runtime support for localized Debug Settings help comments by loading an optional per-locale settings_comments.xml overlay after the viewer language/skin has been initialized, with English comments preserved as the fallback. Ships an initial complete Portuguese (pt) translation for the comments and completes missing PT labels in the Debug Settings floater XUI.

Changes:

  • Load skins/default/xui/{locale}/settings_comments.xml at startup (if present) and apply comment overrides to both Global and PerAccount control groups.
  • Add PT localized settings_comments.xml providing translated comments for Debug Settings entries.
  • Update PT floater_settings_debug.xml labels (title/search text/columns/boolean labels/hide-default checkbox).

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
indra/newview/llappviewer.h Declares LLAppViewer::loadLocalizedSettingsComments() for localized comment overlay loading.
indra/newview/llappviewer.cpp Implements localized comment loading/parsing and applies overrides after language/skin initialization.
indra/newview/skins/default/xui/pt/settings_comments.xml Adds PT localized comment map for Debug Settings (LLSD XML).
indra/newview/skins/default/xui/pt/floater_settings_debug.xml Completes PT UI string overrides for the Debug Settings floater.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@marchcat marchcat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!

The code looks good.

@akleshchev

akleshchev commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@marchcat please note that apply_localized_comments replaces descriptions in the settings, it probably saves that way to any local file. Probably not a problem as those are user only, but worth a note.

Comment thread indra/newview/llappviewer.cpp Outdated
LLControlVariablePtr control = group.getControl(it->first);
if (control.notNull())
{
control->setComment(it->second.asString());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps make sure string is not empty? Just in case.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you like me to make this small change, or will you make this small adjustment yourself? or is it fine as it is?
@marchcat @akleshchev

vedned added a commit to vedned/viewer that referenced this pull request Jul 1, 2026
Address review feedback on PR secondlife#5956: do not call setComment() when
the localized string is empty, preserving the English fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
vedned added a commit to vedned/viewer that referenced this pull request Jul 1, 2026
Address review feedback on PR secondlife#5956: do not call setComment() when the localized string is empty, preserving the English fallback.
@vedned vedned force-pushed the Add-localized-Debug-Settings branch from 63e01c1 to abf9392 Compare July 1, 2026 14:33
@vedned

vedned commented Jul 1, 2026

Copy link
Copy Markdown
Author

Applied the empty-string guard in apply_localized_comments() as suggested — empty localized values now keep the English fallback.
Thanks for the review!

Address review feedback on PR secondlife#5956: do not call setComment() when the localized string is empty, preserving the English fallback.
@vedned vedned force-pushed the Add-localized-Debug-Settings branch from abf9392 to 45fc31b Compare July 1, 2026 14:52
@akleshchev akleshchev requested a review from Copilot July 1, 2026 17:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.

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.

4 participants