Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (37 sloc) 2.47 KB
<plugin name='i18n-gettext' version='0.96' grailsVersion='1.3.4 &gt; *'>
<author>Rainer Brang, Backend-Server GmbH &amp; Co. KG</author>
<title>I18n gettext plugin for grails</title>
<description>This plugin adds i18n support to your app, in 'gnu gettext'-style.
1 First, you need to wrap special tags or service calls around all strings you want to translate.
2 Then you call "grails i18n-gettext" to extract all translatable strings from your sources.
3 Now you translate all strings from step 2 which you will find in .po files in your i18n directory.
4 Call "grails i18n-gettext makemo" to compile your translated .po files into resource classes.
5 repeat 1-4 each time you added some new strings to your application. Existing translations will be merged in.
During runtime: The methods, you wrapped around the strings, will pick the correct translation according to the
current locale, and return the translated string. You may also force a locale for a specific call.
What you need: The developer needs these command line tools for the development machine: xgettext, msgmerge and msgfmt
The translator may like: PoEdit or alike to translate texts.
You will love the dead simple plural form handling and FormatMessage-like String handling. Additionally, you can
forget about inventing lookup keys for your .properties files, because for gnu gettext, the original string is the key.
Plus: No more problems with special chars like german umlauts. gettext can handle that.
You can exclude directories from being scanned for translatable strings in your Config.groovy file.
a) Gnu gettext can not handle groovy's "here-doc" strings, so don't try to wrap tr() or alike around them. Also some
xgettext binaries seem to dislike here-doc strings so much, they don't parse files containing here-doc files correctly.
b) Your original strings should be english, because Gnu gettext can't cope with non-ascii characters as original strings.
Many thanks to:
Donal Murtagh for testing and giving valuable feedback and ideas!
<dependencies />
<behavior />