[jbosstools-dev] JBoss Tools .pot files checked in; careful when renaming .properties!

Sean Flanigan sflaniga at redhat.com
Fri Nov 28 02:41:03 EST 2008


G'day all,

I finally bit the bullet and put in a somewhat kludgy workaround for the
fact that properties files are not kept in the same directory under each
plugin, but all over the place (src, src/main, resources, jbosscore,
...).  I can always take out the workaround when
https://jira.jboss.org/jira/browse/JBIDE-2972 is resolved.

With the workaround, the pot filenames should be fairly stable, so I've
checked in the converted pot files under i18n/po.

I really, really tried to avoid checking in generated files like pot
files.  However, keeping pot files in the source tree seems to be a
universal convention for gettext projects, and corresponding pot and po
files are usually kept in the repository together.  This enables
(non-programmer) translators to merge new strings for translation just
by checking out the po directory, without having to run xgettext (or
Ant-Gettext, in this case) against the entire codebase themselves.

Based on feedback from the L10n team, I have also changed the filename
mapping used when converting from .properties to .pot files.  The pot
filename now eliminates segments like "src", "src/main", "resources",
"jbosscore", etc which are very likely to change over time.  I have also
flattened the remaining directory hierarchy.

I think this retais enough of the original path to prevent name
collisions, but shortens it enough to be more changeproof and easier for
translators to work with.

With the new mapping, the names of source directories can be refactored
without affecting the .pots and thus invalidating translations.  For
instance, changing myplugin/src/**/*.properties to
myplugin/resources/**/*.properties is perfectly safe.   But changing the
name of a module, a plugin or a .properties file (or its package) will!
 (See the end of this email.)

Thus the property file org/hibernate/console/ConsoleMessages.properties
in the plugin org.hibernate.eclipse (module hibernatetools) is mapped to:

i18n/po/hibernatetools/org.hibernate.eclipse-org.hibernate.console.ConsoleMessages/
org.hibernate.console.ConsoleMessages.pot

The po/pot files are still grouped into modules (for managability), and
we keep track of the plugin id and the resource path (ie the path used
at runtime to load the resource).  The resource path is used again for
the filename within the directory, partly to make it easier to find (eg
in Eclipse, press Ctrl-Shift-R, the enter *ConsoleMessages or other
wildcard).

In accordance with the Gettext tools' default conventions, po files will
be kept in the same directory, but named ${locale}.po.  So the above
directory will look like this when translated:
i18n/po/hibernatetools/org.hibernate.eclipse-org.hibernate.console.ConsoleMessages/
  de_DE.po
  es_ES.po
  fr_FR.po
  org.hibernate.console.ConsoleMessages.pot
  pt_BR.po
  zh_CN.po

Please be careful:
1. when renaming modules, plugins, .properties files, or packages which
contain .properties files, or
2. when moving plugins to a different module.

Any of these changes will prevent existing translations (when we have
some) from being picked up, unless the affected po directories and files
are manually renamed to suit.  By me, probably.  But feel free to rename
the affected po directories/files if you feel confident to!

I'm certainly not saying "don't rename things", but please try to go
easy on me!  Thanks!

Regards,

Sean.

-- 
Sean Flanigan

Senior Software Engineer
Engineering - Internationalisation
Red Hat

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 551 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/jbosstools-dev/attachments/20081128/d1f6826b/attachment.bin 


More information about the jbosstools-dev mailing list