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/me/myBundle_fr_FR.properties)? Then use either the
> PropertyResourceBundle or Properties classes?
I could get at the locale ID that way, but there is no way to set the
locale on a PropertyResourceBundle. At least no obvious way, like a
.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@...> wrote:
> From: Martin Wunderlich <martin_wu@...>
> Subject: [i18n-prog] Java question: How to construct a ResourceBundle from a
file
> To: "Ian Davies" <i18n-prog@yahoogroups.com>
> 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/Localisation EN <-> DE
www.martinwunderlich.com
----------------------------------------------------------
Free / open-source software for translation/localisation:
www.martinwunderlich.com/foss-links.html
----------------------------------------------------------
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
----------------------------------------------------------