Open GoogleCodeExporter opened 8 years ago
That's already possible with the <keywords> configurations, I do this as
following for my webapp with Freemarker templating:
<properties>
<!-- Gettext -->
<gettext.sourceLocale>en</gettext.sourceLocale>
<gettext.keysFile>messages.pot</gettext.keysFile>
<!--
Add the keywords:
_ = 1st param is singular form
_p = plural, 1st param is singular, 2nd param is plural form
_noop = 1st param is singular form, this one is a special-case
@see http://www.gnu.org/software/gettext/manual/gettext.html#Special-cases
Set extra options to the xgettext command (without the backslashes!):
\-\-no-location = do not write '#: filename:line' lines in PO files
\-\-add-comments[=TAG] = place comment block with TAG (or those preceding keyword lines) in PO file
-->
<gettext.keywords>-k_ -k_p:1,2 -k_noop --no-location --add-comments=///</gettext.keywords>
<gettext.poDirectory>${project.build.resourceDirectory}/locale</gettext.poDirectory>
</properties>
<build>
<plugins>
<plugin>
<!-- http://code.google.com/p/gettext-commons/
http://gettext-commons.googlecode.com/svn/maven2-plugins-site/index.html
-->
<groupId>org.xnap.commons</groupId>
<artifactId>maven-gettext-plugin</artifactId>
<version>${gettext.version}</version>
<configuration>
<targetBundle>Messages</targetBundle>
<sourceDirectory>${project.basedir}/src</sourceDirectory>
<sourceLocale>${gettext.sourceLocale}</sourceLocale>
<extraSourceFiles>
<!-- Use build specific templates directory -->
<directory>${freemarker.templates.dir}</directory>
<includes>
<!-- Include FreeMarker templates -->
<include>**/*.ftl</include>
</includes>
</extraSourceFiles>
<keysFile>${gettext.keysFile}</keysFile>
<keywords>${gettext.keywords}</keywords>
<poDirectory>${gettext.poDirectory}</poDirectory>
</configuration>
<executions>
<execution>
<id>merge</id>
<phase>generate-sources</phase>
<goals>
<goal>merge</goal>
</goals>
</execution>
<execution>
<id>dist</id>
<phase>compile</phase>
<goals>
<goal>dist</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Original comment by pvdis...@gmail.com
on 24 Jan 2011 at 2:09
Awesome, this is helping me tremendously.
Would you be so kind to show some examples in your freemarker templates,
ideally including a case with plural text? Much appreciated!
Hank
Original comment by hankipa...@gmail.com
on 29 Sep 2011 at 1:26
Original issue reported on code.google.com by
berge...@gmail.com
on 1 May 2010 at 1:54