Maven Gettext Plugin

A plugin to integrate gettext tools into a Maven build.

This plugin is for Maven 1.x. A Maven 2.x plugin is available as well.

Installation

There are two alternative ways to install the plugin. Choose one:

  • The easiest way to install the gettext plugin is through Maven:
    maven plugin:download -DartifactId=maven-gettext-plugin -DgroupId=xnap-commons -Dversion=1.1
  • Alternatively add a dependency to your project.xml:
    <dependency>
      <groupId>xnap-commons</groupId>
      <artifactId>maven-gettext-plugin</artifactId>
      <version>1.1</version>
      <type>plugin</type>
    </dependency>
  • And add the XNap Commons repository to your project.properties:

    maven.repo.remote = http://www.ibiblio.org/maven,http://xnap-commons.sf.net/repository
    

Usage

Expected Project Layout

If you are using the XNap Commons for internationalization (i18n) and if your project is layed out as shown below, the plugin will not require any configuration through properties.

+ po
  - keys.pot
  - xy.po
+ src
  + java

Build process integration

Invoke the merge goal to create or update your key template and po files:

maven gettext:merge

Additionally create a file called maven.xml in your project's base directory:

<project>
  <postGoal name="java:compile">
    <attainGoal name="gettext:dist"/>
  </postGoal>
</project>

This will update your Java class or property files from the po files each time the project is compiled.