Skip to content

docs(sdk7): expand player language docs (getPlayerLanguage / onPlayerLanguageChanged) - #260

Open
EibrielInv wants to merge 2 commits into
mainfrom
docs/player-language-3029
Open

EibrielInv wants to merge 2 commits into
mainfrom
docs/player-language-3029

Conversation

@EibrielInv

@EibrielInv EibrielInv commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What

Completes the creator docs for getPlayerLanguage() / onPlayerLanguageChanged from @dcl/sdk/platform (shipped in @dcl/sdk 7.30.0, decentraland/js-sdk-toolchain#1622). Refs decentraland/godot-explorer#3029.

main already had a short "Get player language" section. This expands it, building on #227 (which now conflicts with main).

Changes

  • creator/sdk7/interactivity/runtime-data.md: rewrites Get player language (same heading, so the releases.md anchor still works):
    • Tag format: BCP 47, region kept, _ → -, case kept.
    • It's the client's UI language, not the device's; clients only report languages they're translated to.
    • Returns 'en' before the client reports, on clients that don't report, and for empty/invalid values. Never empty.
    • React to language changes: fires only on a change, including the first non-'en' report.
    • Translate your scene's text: t() helper (full tag → base language → English), React ECS example (re-renders every tick) and a TextShape example updated in onPlayerLanguageChanged.
  • creator-esp/sdk7/interactivity/runtime-data.md: same section in Spanish, identical code.
  • creator/build-for-mobile/develop/detect-platform.md: getPlayerLanguage() added to the Available functions list (and its import line), plus a Related link.
  • ai-sdk-context/sdk7-examples.mdc: Player Language example.
  • No minimum SDK version note on the pages; the 7.30.0 entry in releases.md already covers it.

How it was checked

  • Behaviour matches packages/@dcl/sdk/src/platform/index.ts (unchanged 7.30.0 → 7.33.0) and the Godot explorer (Runtime.js sends configurations.locale = resolved UI locale; localeChanged only on a real Settings change).
  • All code blocks type-check (strict) against @dcl/sdk@7.33.0.
  • npm test, check:links, check:anchors, check:navigation pass.

Supersedes #227 and #236 (the latter would duplicate the section in user-data.md).

…LanguageChanged)

Fallback cases, first-report event, translation helper with UI and TextShape
examples, Spanish version, link from detect-platform, AI context example.
Refs decentraland/godot-explorer#3029
@EibrielInv
EibrielInv marked this pull request as ready for review November 6, 2026 17:55
@EibrielInv
EibrielInv requested a review from a team November 6, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant