We're i18n'ing an application, and the rubber is hitting the road.
Properties files have the form file_'lang'_'region'.properties.
This allows us to generate different text (for example) for a single property for British English, US English, and French (assuming French is my default locale.)
My question involves Unicode. We have to store Unicode in a database, but there are times where we'd prefer to use properties files. Out plan is to generate the properties files from the database so there is one official source.
Finally: Does unicode take region into account? For example, US English could be defined in the following file: file_en_US.properties while British English could be in file_en_BR.properties.
If encoding takes region into account then my phrase table needs the language and the region. If it doesn't, then it only needs the language.
Unicode encoding is independent of either language or region. It's a question of content: if you have content for en_US that is different from en_GB, then you need two property files, otherwise one "en" file would be sufficient. [ September 12, 2006: Message edited by: Ulf Dittmer ]
How are you reading your properties files? The java.util.Properties class requires them to be in ISO 8859-1, not any Unicode encoding, doesn't it?
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Joined: Mar 22, 2005
That's where the native2ascii utility comes into play.
Joined: Mar 15, 2005
Thank you. Your point that the unicode and language is subtle but interesting.
Joined: Oct 30, 2001
Originally posted by Ulf Dittmer: That's where the native2ascii utility comes into play.
Well, yes, but that's a bit of a clunky way to work, isn't it? If your data really does have lots of international characters in it, wouldn't it be better to choose a file format that copes properly? E.g. XML.
Joined: Mar 22, 2005
It's an additional step to use native2ascii, but in a big Ant build, what's another step out of 30 or so
But seriously, property files are the way to go for Java to pick up Locale-specific content, without anything that needs to be programmed to make it work. How would you teach the JVM to use XML files - by writing your own ResourceBundle implementation?