Skip to content

Commit 2cf6b3e

Browse files
chore(docs): update code docs
1 parent 10633ae commit 2cf6b3e

5 files changed

Lines changed: 34 additions & 6 deletions

File tree

docs/components_settings_settings.bs.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,9 +742,19 @@
742742
newLocale = m.languagePicker.selectedCode
743743
selectedSetting = m.userLocation.peek().filteredChildren[m.settingsMenu.itemFocused]
744744

745-
' Save to user registry (empty string = automatic)
745+
' Save to registry (empty string = automatic). The auto-sync observer routes
746+
' global* settings to the device-wide section and per-user settings to the
747+
' user's section.
746748
user.settings.Save(selectedSetting.settingName, newLocale)
747749

750+
' globalTranslationLocale is the device-wide sign-in-screen language, consumed
751+
' ONLY pre-login (see resolveTranslationLocale). It must NOT live-reload the
752+
' current post-login session — that would re-theme the home screen the user is
753+
' looking at to the device default, overriding their own language. It takes
754+
' effect the next time the sign-in screens render (Sign Out / Change User),
755+
' which re-resolve the pre-login locale at the appStart login-flow entry.
756+
if selectedSetting.settingName = "globalTranslationLocale" then return
757+
748758
' Resolve and load the new locale
749759
if newLocale = ""
750760
resolvedLocale = resolveTranslationLocale(true)

docs/data/search.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/module-translateLocale.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/source_main.bs.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@
3737

3838
appStart:
3939
m.global.sceneManager.callFunc("clearScenes")
40+
' Re-resolve the pre-login locale on every entry to the login flow. We reach
41+
' here both at cold start AND on re-entry from Change Server / Change User /
42+
' Sign Out (which `goto appStart`). Without this re-resolve, a changed global
43+
' sign-in language would only apply after a full app restart, and the sign-in
44+
' screens would render in the just-signed-out user's language rather than the
45+
' device-wide default. isPostLogin defaults to false here → pre-login cascade.
46+
loadTranslations(resolveTranslationLocale())
4047
' First thing to do is validate the ability to use the API
4148
if not LoginFlow() then return
4249

docs/source_utils_translateLocale.bs.html

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
' from source/ context (Main.bs, session.bs) where config.bs is auto-scoped.
77

88
' Determine which locale to load using the fallback cascade.
9-
' Pre-login (isPostLogin=false): device locale -> en_US
9+
' Pre-login (isPostLogin=false): global sign-in language -> device locale -> en_US
1010
' Post-login (isPostLogin=true): user setting -> server language -> device locale -> en_US
1111
' @param {boolean} isPostLogin - Whether a user is authenticated
1212
' @param {string} serverLanguage - Language from server CustomPrefs.language (empty if unavailable)
@@ -24,13 +24,24 @@
2424
return normalizeLocaleCode(serverLanguage)
2525
end if
2626

27-
' Priority 3: Roku device locale
27+
' Priority 3: Global device-wide sign-in language — PRE-LOGIN ONLY.
28+
' Localizes the server-select / user-select screens, where no user context
29+
' exists yet. Read via getSetting (NOT getUserSetting) so it resolves with no
30+
' signed-in user. Deliberately skipped post-login: a signed-in user's session
31+
' is governed entirely by their own setting / server pref / device locale, so a
32+
' user's home screen never inherits the device-wide sign-in default.
33+
if not isPostLogin
34+
globalLocale = getSetting("globalTranslationLocale")
35+
if isValidAndNotEmpty(globalLocale) then return globalLocale
36+
end if
37+
38+
' Priority 4: Roku device locale
2839
deviceLocale = m.global.device.locale
2940
if isValidAndNotEmpty(deviceLocale)
3041
return mapRokuLocaleToTranslationLocale(deviceLocale)
3142
end if
3243

33-
' Priority 4: Hardcoded default
44+
' Priority 5: Hardcoded default
3445
return "en_US"
3546
end function
3647

0 commit comments

Comments
 (0)