[jsword-devel] i18n features in Java 6

Manfred Bergmann manfred.bergmann at me.com
Thu Dec 30 15:11:08 MST 2010


Sorry, if this is out of context, I didn't completely follow the discussion.
I've created a ResourceBundle subclass that will load xml based properties files which support UTF8 character set.
It's in Scala but you'll just have to translate to Java.
Maybe it's of use.

You'll then load a resource bundle like this:
ResourceBundle.getBundle(coreMessageBundle, locale, new XmlResourceBundleControl)



Manfred

-------------- next part --------------
A non-text attachment was scrubbed...
Name: XmlResourceBundle.scala
Type: application/octet-stream
Size: 1868 bytes
Desc: not available
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20101230/0e00f806/attachment.obj>
-------------- next part --------------

Am 30.12.2010 um 22:41 schrieb Martin Denham:

> There also seems to be a Properties.loadFromXML() method in Java 5 which uses UTF-8 encoded xml files which may be of interest.
> 
> On 30 December 2010 16:33, DM Smith <dmsmith at crosswire.org> wrote:
> On 12/29/2010 04:14 PM, Martin Denham wrote:
> Hi,
> 
> I have been grappling with escaped foreign characters in properties files recently.  Android resource files allow normal foreign characters to be used but standard java properties require awkward escape codes e.g. /u0107 resulting in unreadable files containing strings like:
>   Pentateuch = Pi\u0119cioksi\u0105g
> In case somebody else makes the same mistake there is a utility called native2ascii that converts foreign characters to escape codes.
> 
> It is a painful process. In Eclipse I use a plugin to make it easier. I've used JInto with reasonable success. (Right now my Eclipse installation is broken or I'd check to see what I'm currently using.)
> 
> 
> 
> However, there is a new feature in Java 6 that allows foreign characters to be entered directly into properties files. See this article for info: http://jdevelopment.nl/java/internationalization-jsf-utf8-encoded-properties-files/
> 
> I saw this (native UTF-8, rather than encoded ASCII) as I was poking around the other day in the Properties.java source code. From a quick glance it appeared that to use it one had to use new methods. That a file was either encoded or unencoded and the user had to know which one. I did not look to see how ResourceBundle knew whether to do one or the other.
> 
> The problem we have with Java versions is Mac support. Tiger (aka 10.4) was released April 2005 and does not have Java 6. Leopard (aka 10.5), released October 2007, has Java 6. For PowerPC and slower Intel chips, Tiger is faster than Leopard (aka 10.5, released October 2007). I think it is reasonable for JSword to support Java 5. When Lion comes out, we might move to Java 6.
> 
> So the question is whether we can snag the new Properties and use it in place of the current and have ResourceBundle use it?
> 
> 
> 
> I realise you are trying to simplify the translation of resource files so thought I would throw this in.
> 
> I'm looking forward to it!
> 
> 
> Best regards
> Martin
> 
> 
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel
> 
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel



More information about the jsword-devel mailing list