[josm-dev] Source code formatting template?

Dirk Stöcker openstreetmap at dstoecker.de
Wed Aug 27 12:15:42 BST 2008


On Wed, 27 Aug 2008, Frederik Ramm wrote:

>> As tr() is a static function that is called at runtime this should not
>> make any difference.

No. The translations are extracted from the sources, so the source design 
is important. You can't use whatever methods to join a string, as these 
will not be detected by the text extractor.

Plainly it is a parser, which scans for "tr(" and takes everything till 
the next "," or ")". When it is a string literal, then it is translatable.
Some more logic is used by gettext to make it more reliable.

> I am unsure how the process that extracts the string constants to be
> translated works. It can't possibly *execute* every branch of code that
> contains a tr()? But as I said, not my core competency ;-)

But the joining of normal string laterals with + works. Example:
src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java:93

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




More information about the josm-dev mailing list