[josm-dev] question about UI strings in plugins

2010-04-18 Thread Rolf Bode-Meyer
Hello

I'm about to extend an existing plugin. Function wise it's no big
deal, but I seem not to understand how UI strings are handled.
There are "labels" with which to call tr(), but where can I put it new
strings to be addressable by new labels?

Rolf

___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev


Re: [josm-dev] question about UI strings in plugins

2010-04-18 Thread Frederik Ramm
Hi,

Rolf Bode-Meyer wrote:
> I'm about to extend an existing plugin. Function wise it's no big
> deal, but I seem not to understand how UI strings are handled.
> There are "labels" with which to call tr(), but where can I put it new
> strings to be addressable by new labels?

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()).

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frede...@remote.org  ##  N49°00'09" E008°23'33"

___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev


Re: [josm-dev] question about UI strings in plugins

2010-04-18 Thread Mike N.
> I'm about to extend an existing plugin. Function wise it's no big
> deal, but I seem not to understand how UI strings are handled.
> There are "labels" with which to call tr(), but where can I put it new
> strings to be addressable by new labels?

  Just create new English strings in the tr() calls.   The new tr() strings 
will appear to everyone in English until they translate their own language. 
Use care when creating each string so that it won't need to be changed 
later - resulting in the translators needing to update the translations.
 


___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev


Re: [josm-dev] question about UI strings in plugins

2010-04-18 Thread Sebastian Klein
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

___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev


Re: [josm-dev] question about UI strings in plugins

2010-04-18 Thread Karl Guggisberg
>  I think it has changed, right?
Yes. The rules are much simpler now:

* Always escape single quotes with '', regardless of whether you use tr(), 
trn(), or trc().
   #4160    still claims that double 
quotes won't work in the french translation but the ticket has
   never been confirmed and it is probably outdated.

Regards
Karl


Am 18.04.2010 13:47, schrieb Sebastian Klein:
> 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
>
> ___
> josm-dev mailing list
> josm-dev@openstreetmap.org
> http://lists.openstreetmap.org/listinfo/josm-dev
>
>
___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev


Re: [josm-dev] question about UI strings in plugins

2010-04-18 Thread Rolf Bode-Meyer
2010/4/18 Mike N. :
>> I'm about to extend an existing plugin. Function wise it's no big
>> deal, but I seem not to understand how UI strings are handled.
>> There are "labels" with which to call tr(), but where can I put it new
>> strings to be addressable by new labels?
>
>  Just create new English strings in the tr() calls.   The new tr() strings
> will appear to everyone in English until they translate their own language.
> Use care when creating each string so that it won't need to be changed
> later - resulting in the translators needing to update the translations.

Oh, that's easy. I didn't find where to put the
translated/translatable strings, but if it's taken care of
automatically, that's great.

Thank you all!
Rolf

___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev