internationalization - Wrong Java resource bundle loaded -


in application, i'm using java resource bundle translation of labels. have 2 files:

  • resources.properties labels in english (default language)
  • resources_fr.properties labels in french

then, load bundle properties following command:

resourcebundle.getbundle(resource_bundle_name, locale); 

... locale user's locale.

when i'm working french web browser, that's ok, i'm getting messages in french, locale correctly set fr. when switch browser english us, they're still in french!

the locale variable correctly set en_us locale, getbundle method returns me bundle fr locale instead of returning default bundle...

is normal behaviour? i'm surprised, expecting english values of resources.properties used when locale has no specific resource bundle attached (like french)...

this might clarify question:

http://docs.oracle.com/javase/tutorial/i18n/resbundle/propfile.html

these locale objects should match properties files created in previous 2 steps. example, locale.french object corresponds labelsbundle_fr.properties file. locale.english has no matching labelsbundle_en.properties file, default file used.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

java - More than one row with the given identifier was found: 1, for class: com.model.Diagnosis -