Repository navigation
docs: specify the locale in Grid renderer examples - #6262
Merged
Merged
Conversation
Contributor
Preview DeploymentThis PR has been deployed for preview. URL: https://docs-preview-pr-6262.fly.dev Changed pagesAdded content is highlighted in green; removed content is marked in red on each page.
Built from ec016b9 |
vursen
force-pushed
the
docs/grid-renderers-locale
branch
8 times, most recently
from
October 5, 2026 09:57
aeb06ad to
fc47d7d
Compare
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
force-pushed
the
docs/grid-renderers-locale
branch
from
October 5, 2026 09:59
fc47d7d to
73a8118
Compare
sissbruecker
approved these changes
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
added a commit
that referenced
this pull request
Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previous approach: #6184 proposed a dedicated
NumberRendererexample that creates the currency format with the UI locale,NumberFormat.getCurrencyInstance(UI.getCurrentOrThrow().getLocale()), together with a note that aNumberFormatcreated 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.56for a US user and as1 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:
FormatStyledate examples useUI.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.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.dd/MM/yyyyanddd/MM HH:mm:ss) stay as they are, because the locale has no effect on digit-only patterns.Extracted from #6184.