I think there's a Properties.load( ) method that takes a locale argument.
Phil Ritchie
VistaTEC
700 South Circular Road
Kilmainham
Dublin 8
Ireland
http://www.vistatec.ie
From: Martin Wunderlich [martin_wu@...]
Sent: 05/10/2008 20:45 CET
To: Phil Ritchie <i18n-prog@yahoogroups.com>
Subject: Re[2]: [i18n-prog] Java question: How to construct a ResourceBundle from a file
Hi Phil,
Thanks a lot for the reply!
> Martin
> Â
> So, if I understand, you'd like to be able to open and read a bunch
> of properties files and determine their locale at runtime just
> before writing out the TMX with associated lang attributes?
That's right.
> Â
> Can you determine the locale from the properties' file name
> (Volumes/users/
> PropertyResourceBun
I could get at the locale ID that way, but there is no way to set the
locale on a PropertyResourceBun
.setLocale(string locID) method.
> Â
> If you're just using these classes to get over the encoding in the
> properties files it might be easier to use native2ascii to convert
> them all first to Unicode and then use some of the suggestions below:
> Â
> 1. Regular Expressions
> 2. Alchemy Catalyst
> 3. Rainbow
That sounds like an option, even though I'd rather have a dedicated
tool.
I also checked the source code of OmegaT,
which has a filter for .properties. They are just parsing the
.properties file as a text file and doing the conversion on a
character level. I was hoping there'd be an easier way.
The Maxprograms tool ProptertiesViewer somehow does it. I wonder how.
> Â
> I don't know for sure if 2 or 3 can help but I think they can. I
> can also recommend a good LSP who's engineering team might be able to help.
:-))
Cheers,
Martin
> Â
> Phil Ritchie.
> --- On Sun, 5/10/08, Martin Wunderlich <martin_wu@gmx.
> From: Martin Wunderlich <martin_wu@gmx.
> Subject: [i18n-prog] Java question: How to construct a ResourceBundle from a file
> To: "Ian Davies" <i18n-prog@yahoogrou
> Date: Sunday, 5 October, 2008, 6:58 PM
> Hi all,
> I hope someone on this list might know the answer to the following
> question:
> I am creating a program to process ResourceBundles and do stuff to
> the keys and values (to be more precise, I want to construct a TMX
> file from a bunch of existing translations in .properties files).
> I have come across the problem that there is no constructor for the
> ResourceBundle class that would take a file
> name as input. The only way I can create ResourceBundles, it seems,
> is by referring to the .properties file with a fully qualified
> class name (e.g. com.example. MyBundle) as the base name.
> Any ideas how I can get a working ResourceBundle object by passing in
> the file name (e.g. "/Volumes/users/ me/myBundle. properties" )?? I can
> create a PropertyResourceBun dle object from a FileInputStream
> alright, but when I call .getLocale() on that PropertyResourceBun dle,
> I only get null.
> Any help would be very much appreciated.
> Cheers,
> Martin
>
>
--
------------
Martin Wunderlich, M.A.
Translation/
www.martinwunderlic
------------
Free / open-source software for translation/
www.martinwunderlic
------------
Random aphorism:
"Aquela reinspiração, sem a qual traduzir é apenas parafrasear noutra lÃngua."
"That new inspiration - without which to translate merely means to paraphrase into another language."
- Fernando Pessoa
------------
*********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the sender immediately by e-mail.
www.vistatec.ie
**********************************************************************