In my application, I'm using java resource bundle for the translation of its labels. I currently have two files:
- resources.properties with labels in English (default language)
- resources_fr.properties with labels in French
Then, I load the bundle properties with the following command:
ResourceBundle.getBundle(RESOURCE_BUNDLE_NAME, locale);
... where locale
is the user's locale.
When I'm working with a French web browser, that's ok, I'm getting all my messages in French, as my locale is correctly set to fr. But when I switch my browser to English US, they're still in French!
The locale
variable is correctly set with the en_US locale, but the getBundle
method returns me a bundle with the fr locale instead of just returning the default bundle...
Is it a normal behaviour? I'm very surprised, as I was expecting the English values of resources.properties
to be used when the locale has no specific resource bundle attached to it (like French)...
resources.properties
file as default, I should copy it to aresources_en.properties
file in order to avoid having the system locale (fr) being used. – Stéphane Wantiez