[josm-dev] Make josm use .mo files

Dirk Stöcker openstreetmap at dstoecker.de
Tue Dec 27 13:29:48 GMT 2011


On Tue, 27 Dec 2011, David Paleino wrote:

>> We dropped gettext files as they are wasting a lot of space in the
>> translation. The lang files only carry each string once and not multiple
>> times like .mo does.
>
> What do you mean?
> A gettext .mo file carries each string once -- a msgid + a msgstr. Maybe I
> didn't understand what you meant? :)

We currently have 27 languages. Each english string is included once which 
means we have 27 times the same string in one jar-file. Wasting a lot of 
space. The current format has each string only once. Also some 
optimizations exist for strings which are translated equal to original.

> (but I didn't notice .lang files were more "compact" than .mo, at least in
> size, I admit it)

They have one big disadvantage. The en.lang and the translated files MUST 
be in sync (created together) or translation is broken.

>> Most of the advantages you describe can be reached by simply renaming the
>> lang files to .mo and install them in different locations.
>
> Is that doable? Maybe some property to pass to ant during the build? If you're
> ok with that, I can try doing it (if I'm able to ;)).

Only the language file loader must be adapted to search in different 
location for the files. Debian already does a lot of patching, so this 
should be no problem.

I18n.java is the only place where this is done. I changed the code a bit, 
so now there is one function getting the file, so a Debian specific patch 
could be minimalistic.

Ciao
-- 
http://www.dstoecker.eu/ (PGP key available)




More information about the josm-dev mailing list