This section provides a tutorial example on how to create resource bundles (localization key names with their localized text messages) as properties file for the java.util.PropertyResourceBundle concrete class.
The PropertyResourceBundle class, java.util.PropertyResourceBundle, is a concrete subclass of
the java.util.ResourceBundle class. It implements resource bundles by reading properties files which
contains static maps of localization key names and localized text messages.
Now let's define some localization key names and localized text messages for some general note messages
using properties files for the java.util.PropertyResourceBundle class:
1. Mapping NoteMessage key names to localized text messages for the default locale with file name of
NoteMessage.properties:
STARTING_SYSTEM=Starting the system...
LOADING_SETTINGS=Loading user's settings...
Note that:
The property file names follow the same convention as the bundle class names.
When the NoteMessage bundle is requested, the system will actually read in
the property file, and convert it into a PropertyResourceBundle.
2. Mapping NoteMessage key names to localized text messages for the fr locale with file name of
NoteMessage_fr.properties:
STARTING_SYSTEM=Commencer le système...
LOADING_SETTINGS=Les arrangements de l'utilisateur de chargement...
3. Mapping NoteMessage key names to localized text messages for the fr and CA locale with file name of
NoteMessage_fr_CA.properties
Mapping NoteMessage keys to the fr and CA locale, file name: NoteMessage_fr_CA.properties
LOADING_SETTINGS=Commencer à charger les arrangements de l'utilisateur..