Java Reference
In-Depth Information
What happens at runtime?
The default locale is used, because we didn't specify one. The default locale is platform-de-
pendent:
Unix/POSIX
LANG environment variable (per user)
Windows
Control Panel→Regional Settings
Mac OS X
System Preferences→Language & Text
Others
See platform documentation
ResourceBundle.getBundle() locates a file with the named resource bundle name ( Menus ,
in the previous example), plus an underscore and the locale name (if any locale is set), plus
another underscore and the locale variation (if any variation is set), plus the extension .prop-
erties . If a variation is set but the file can't be found, it falls back to just the country code. If
that can't be found, it falls back to the original default. Table 15-1 shows some examples for
various locales.
Note that Android apps—usually written in Java—use exactly the same mechanism, except
for some small changes in the name of the file in which the properties files are found.
Table 15-1. Property filenames for different locales
Locale
Filename
Default locale
Menus.Properties
Swedish
Menus_sv.properties
Spanish
Menus_es.properties
French
Menus_fr.properties
French-Canadian Menus_fr_CA.properties
Search WWH ::




Custom Search