[josm-dev] question about UI strings in plugins

Sebastian Klein bastikln at googlemail.com
Sun Apr 18 12:47:43 BST 2010


Frederik Ramm wrote:
> Simply add whatever you want in a tr() call. That serves as a hook for 
> the i18n engine but of it remains untranslated then it will just display 
> as-is. Make sure to use proper number formatting and the singular/plural 
> stuff (trn()).

There is some kind of script that runs over all the source files and 
collects the strings for translation. (in the folder editors/josm/i18n)
The strings are uploaded to launchpad and all the translations are then 
copied to core/data/*.lang. This is done manually approximately once a week.

 From the wiki page
http://josm.openstreetmap.de/wiki/DevelopersGuide/StyleGuide :

wrong: new JLabel(tr("My Label " + labelId));

right: new JLabel(tr("My Label {0}", labelId));


Can anyone confirm that the following still holds:

 >>>>>>>>>

For simple strings without substitution you need not change anything:

new JButton(tr("Don't press me!"))

For tr with more than one parameter, the apostrophe is special. (Like 
backslash in C)
It needs to be escaped by another apostrophe:

new JButton(tr("Don''t press me more than {0} times!", n))

<<<<<<<<<

I think it has changed, right?

__

Sebastian




More information about the josm-dev mailing list