Skip to content

Conversation

@hyyan
Copy link
Member

@hyyan hyyan commented Feb 11, 2026

closes #734

```
### 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`.

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.

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.WordList] Use 'preceding' instead of 'above'.


// When the locale changes, Jakarta validators automatically
// produce messages in the new locale
context.setLocale(Locale.GERMAN);
Copy link
Member

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.

Copy link
Member Author

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().

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.

Document the built-in translation system

2 participants