Skip to content

Commit

Permalink
Localization: update user documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
d-kozak committed Mar 19, 2021
1 parent cb41754 commit 3cc1522
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions substratevm/Resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ Then:

See also the [guide on assisted configuration of Java resources and other dynamic features](BuildConfiguration.md#assisted-configuration-of-native-image-builds).

## Locales

It is also possible to specify which locales should be included in the image and what should be the default one. For
example, to switch the default locale to German, but also include French and English, one can use the following hosted options.
```shell
native-image -H:DefaultLocale=de -H:IncludeLocales=fr,en
```
The locales are specified using [language tags](https://docs.oracle.com/javase/tutorial/i18n/locale/matching.html). All locales can be included via ``-H:+IncludeAllLocales``, but please note that it increases the size of the resulting binary.

## Resource Bundles in Native Image

Java localization support (`java.util.ResourceBundle`) enables Java code to load L10N resources and show the right user messages suitable for actual runtime settings like time locale and format, etc.
Expand All @@ -73,3 +82,4 @@ Alternatively, bundles can be specified directly as options to `native-image` as
```shell
native-image -H:IncludeResourceBundles=your.pgk.Bundle,another.pkg.Resource,etc.Bundle ...
```
By default, the requested bundles are included for all requested locales. In order to optimize this, it is possible to use ``IncludeResourceBundles`` with locale specific substring, for example ``-H:+IncludeResourceBundles=com.company.bundles.MyBundle_fr-FR`` will include the bundle only in French.

0 comments on commit 3cc1522

Please sign in to comment.