localization - Loading of Java message properties for internalization -


i have following java i18n message class.:

public class messages {       private static final string bundle_name = "languages.message";     private static final resourcebundle resource_bundle = resourcebundle.getbundle(bundle_name);      private messages() {     }      public static string geti18n(string key) {         try {             return resource_bundle.getstring(key);         } catch (missingresourceexception e) {             return '!' + key + '!';         }     }      public static string geti18n(string key, object... params  ) {         try {             return messageformat.format(resource_bundle.getstring(key), params);         } catch (missingresourceexception e) {             return '!' + key + '!';         }     } } 

i have created following message properties files.:

message.properties message_de.properties message_de_de.properties 

in program translation according default locale of system. if de_de, german message properties message_de_de.properties loaded.

if default locale de_ch, there no message properties file. message_de.properties fallback loaded or need implement myself?

according this blog post right.

so when default locale of system de_de , request resource locale en_us, lookup order properties files is:

  1. myapp_en_us.properties
  2. myapp_en.properties
  3. myapp_de_de.properties
  4. myapp_de.properties
  5. myapp.properties

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -