Skip to content

docs: specify the locale in Grid renderer examples - #6262

Merged
vursen merged 1 commit into
mainfrom
docs/grid-renderers-locale
Oct 5, 2026
Merged

vursen merged 1 commit into
mainfrom
docs/grid-renderers-locale

Conversation

@vursen

@vursen vursen commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Previous approach: #6184 proposed a dedicated NumberRenderer example that creates the currency format with the UI locale, NumberFormat.getCurrencyInstance(UI.getCurrentOrThrow().getLocale()), together with a note that a NumberFormat created without a locale uses the default locale of the server and a link to the Language Selection page (see the paragraph in #6184). The UI locale is wrong for that example. getCurrencyInstance(locale) takes the currency from the locale, so the same price would render as $1,234.56 for a US user and as 1 234,56 € for a Finnish user. A price is an amount in one specific currency, so its currency symbol must not change with the user's locale.

This PR: Each example passes the locale that fits what it formats:

  • The two FormatStyle date examples use UI.getCurrentOrThrow().getLocale(). Here the locale only changes how the same date is presented, which is what localized formats are for. The text says the date is rendered in the format specified by the UI locale, and a link to Language Selection follows each example.
  • The two number examples use Locale.US, because both render a price in US dollars: the currency format takes the currency from the locale, and the string format hardcodes $. Their lead-in sentences say so.
  • The string-pattern date examples (dd/MM/yyyy and dd/MM HH:mm:ss) stay as they are, because the locale has no effect on digit-only patterns.

Extracted from #6184.

@vursen
vursen requested a review from sissbruecker October 5, 2026 09:18
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Preview Deployment

This PR has been deployed for preview.

URL: https://docs-preview-pr-6262.fly.dev

Changed pages

Added content is highlighted in green; removed content is marked in red on each page.

Built from ec016b9

@vursen
vursen force-pushed the docs/grid-renderers-locale branch 8 times, most recently from aeb06ad to fc47d7d Compare October 5, 2026 09:57
Pass the locale of the current UI to the date and number formatters on
the Grid renderers page instead of a hardcoded or default locale, so
that the examples format values according to the user's locale.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vursen
vursen force-pushed the docs/grid-renderers-locale branch from fc47d7d to 73a8118 Compare October 5, 2026 09:59
@sissbruecker sissbruecker added the target/v25.3 Automatically cherry-pick to the v25.3 branch label Oct 5, 2026
@vursen vursen changed the title docs: use an explicit locale in Grid renderer examples docs: specify the locale in Grid renderer examples Oct 5, 2026
vursen added a commit that referenced this pull request Oct 5, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vursen
vursen merged commit 3c512c2 into main Oct 5, 2026
11 checks passed
@vursen
vursen deleted the docs/grid-renderers-locale branch October 5, 2026 10:24
vursen added a commit that referenced this pull request Oct 5, 2026
Co-authored-by: Sergey Vinogradov <mr.vursen@gmail.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-picked-v25.3 target/v25.3 Automatically cherry-pick to the v25.3 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants