16.2. Defining Resource Bundles

Resource bundles are made up of 1 or more .properties files. Each file contains a key-value reference which is used to retrieve and display text in a given language. Properties files, defined to be of the same resource bundle, have the following naming structure:

ApplicationResources.properties

        msg.bienvenue.1=<B>Bienvenue dans l'application XYZ</B>           
        msg.bienvenue.2=Heureux de vous servir en franais.
        boutton.login=Authentifier
        boutton.logout=Quitter

    

ApplicationResources_fr_CA.properties

        msg.bienvenue.1=<B>Bienvenue dans l'application XYZ</B>
        msg.bienvenue.2=Heureux de servir nos amis Canadiens en franais.
        boutton.login=Authentifier
        boutton.logout=Quitter

   
      

ApplicationResources_en.properties

        msg.bienvenue.1=<B>Welcome in XYZ application</B>
        msg.bienvenue.2=Happy to serve you in english.
        boutton.login=Login
        boutton.logout=Logout

      

ApplicationResources_es.properties

        msg.bienvenue.1=<B>Recepcin en la aplicacin XYZ</B>
        msg.bienvenue.2=Feliz servirle en espaol
        boutton.login=Conexin
        boutton.logout=Fin de comunicacin
      

In this example, the default language is French. In addition to the default language, this application supports English and Spanish. For French speaking clients from Canada, a special resource has also been developed.