I have 2 .properties
files in my java project and I want to define one of them as default file to be used when the language of the operating system is different from the 2 languages already defined.
Can you tell me please what should I add to my code to make that possible?
views:
40answers:
2Thank you for your answer :-)
bnabilos
2010-05-25 20:56:02
A:
Name the 2 .properties files by the same base name plus the language code, e.g. prop_de.properties and prop_en.properties. Then copy one of them and name it prop.properties. This is the fallback. If the files are in package org.foo then
ResourceBundle bundle = ResourceBundle.getBundle( "org.foo.prop" );
gives you a bundle with the behaviour you want.
openCage
2010-05-25 20:50:54
Thank you. I was looking for using one of the specified language files as default file without creating a new .properties file and copy the content to it. But I'll use that for the moment.Thanks :-)
bnabilos
2010-05-25 20:58:54