-
Notifications
You must be signed in to change notification settings - Fork 0
feat: document i18n translation system #736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| ``` | ||
| ### Configuring supported locales | ||
|
|
||
| The `supported-locales` setting tells webforJ which locales your app supports. This list is used by auto-detection to match the user's browser locale against available translations. The first locale in the list is used as the default fallback when no better match is found. The property key is `webforj.i18n.supported-locales` and accepts a list of [BCP 47](https://en.wikipedia.org/wiki/IETF_language_tag) language tags, for example `en, de`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [vale] reported by reviewdog 🐶
[Google.Acronyms] Spell out 'BCP', if it's unfamiliar to the audience.
| ``` | ||
|
|
||
| In the example above, the code applies the `EmailValidator` to an email field with a custom error message specifically tailored for that field. This allows for a more directed and helpful user experience if the validation fails. | ||
| In the example above, the code applies the `EmailValidator` to an email field with a custom error message specifically tailored for that field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Google.WordList] Use 'preceding' instead of 'above'.
|
|
||
| // When the locale changes, Jakarta validators automatically | ||
| // produce messages in the new locale | ||
| context.setLocale(Locale.GERMAN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which locale is used initially if this setlocale isnt done? Might make sense to point to default behavior as a note.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is the default JVM locale,I mentioned that in docs/docs/advanced/locale-management.md:
The app locale can be configured using the webforj.locale property. This sets the locale that the app uses from startup, affecting all locale-sensitive formatting and text. When webforj.locale isn't configured, the app falls back to the server's JVM default locale. You can read the current locale at any time with App.getLocale().
closes #734