java.util.PropertyResourceBundle - Resource Bundles as Properties Files

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:

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

Table of Contents

 About This JDK Tutorial Book

 JDK (Java Development Kit)

 Java Date-Time API

 Date, Time and Calendar Classes

 Date and Time Object and String Conversion

 Number Object and Numeric String Conversion

Locales, Localization Methods and Resource Bundles

 java.util.Locale - Localization and Internationalization

 Locale Sensitive Operations

 java.util.ResourceBundle - Resource Bundle Abstract Class

 java.util.ListResourceBundle - Resource Bundles as Lists

java.util.PropertyResourceBundle - Resource Bundles as Properties Files

 java.util.ResourceBundle.getBundle() - Retrieving Resource Bundles

 Calling and Importing Classes Defined in Unnamed Packages

 HashSet, Vector, HashMap and Collection Classes

 Character Set Encoding Classes and Methods

 Character Set Encoding Maps

 Encoding Conversion Programs for Encoded Text Files

 Java Logging

 Socket Network Communication

 Datagram Network Communication

 DOM (Document Object Model) - API for XML Files

 SAX (Simple API for XML)

 DTD (Document Type Definition) - XML Validation

 XSD (XML Schema Definition) - XML Validation

 XSL (Extensible Stylesheet Language)

 Message Digest Algorithm Implementations in JDK

 Private key and Public Key Pair Generation

 PKCS#8/X.509 Private/Public Encoding Standards

 Digital Signature Algorithm and Sample Program

 "keytool" Commands and "keystore" Files

 KeyStore and Certificate Classes

 Secret Key Generation and Management

 Cipher - Encryption and Decryption

 The SSL (Secure Socket Layer) Protocol

 SSL Socket Communication Testing Programs

 SSL Client Authentication

 HTTPS (Hypertext Transfer Protocol Secure)

 Outdated Tutorials

 References

 Full Version in PDF/EPUB