Tennera Ant-Gettext

Tennera Ant-Gettext provides several Ant tasks for dealing with GNU Gettext catalog files and Java Properties files, including file conversion and comparison, and also extracting translatable strings from source code using regular expressions.

License

License

Categories

Categories

Ant Build Tools
GroupId

GroupId

org.fedorahosted.tennera
ArtifactId

ArtifactId

ant-gettext
Last Version

Last Version

0.9
Release Date

Release Date

Type

Type

jar
Description

Description

Tennera Ant-Gettext
Tennera Ant-Gettext provides several Ant tasks for dealing with GNU Gettext catalog files and Java Properties files, including file conversion and comparison, and also extracting translatable strings from source code using regular expressions.
Project URL

Project URL

https://fedorahosted.org/tennera/ant-gettext
Project Organization

Project Organization

Red Hat

Download ant-gettext

How to add to project

<!-- https://jarcasting.com/artifacts/org.fedorahosted.tennera/ant-gettext/ -->
<dependency>
    <groupId>org.fedorahosted.tennera</groupId>
    <artifactId>ant-gettext</artifactId>
    <version>0.9</version>
</dependency>
// https://jarcasting.com/artifacts/org.fedorahosted.tennera/ant-gettext/
implementation 'org.fedorahosted.tennera:ant-gettext:0.9'
// https://jarcasting.com/artifacts/org.fedorahosted.tennera/ant-gettext/
implementation ("org.fedorahosted.tennera:ant-gettext:0.9")
'org.fedorahosted.tennera:ant-gettext:jar:0.9'
<dependency org="org.fedorahosted.tennera" name="ant-gettext" rev="0.9">
  <artifact name="ant-gettext" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.fedorahosted.tennera', module='ant-gettext', version='0.9')
)
libraryDependencies += "org.fedorahosted.tennera" % "ant-gettext" % "0.9"
[org.fedorahosted.tennera/ant-gettext "0.9"]

Dependencies

compile (3)

Group / Artifact Type Version
org.apache.ant : ant jar 1.8.2
org.fedorahosted.openprops : openprops jar 0.5
org.fedorahosted.tennera : jgettext jar 0.9

test (3)

Group / Artifact Type Version
org.apache.ant : ant-testutil jar 1.8.2
org.infinitest : infinitest jar 4.0.1
junit : junit jar 4.5

Project Modules

There are no modules declared in this project.

Tennera

Tennera is an umbrella project for various Java tools to do with internationalisation, initially tools for processing the Gettext and Properties formats.

JGettext

JGettext includes an ANTLR-based parser for GNU Gettext PO/POT files and a PO/POT generator as well.

Note that JGettext has moved to a new home: https://github.com/zanata/jgettext/

Ant-Gettext (unmaintained)

Ant-Gettext includes various Ant tasks which can convert Java Properties files to and from Gettext PO/POT files. Ant-Gettext makes use of OpenProps and JGettext (below) to do its work.

Some of these tasks have similarities to commands in the GNU Gettext tools and the Translate Toolkit (but generally with fewer options):

  • Gettext2PropTask (gettext2prop) is like 'po2prop' or 'msgcat --properties-output', except that it generates a directory tree of .properties from each PO file (one per locale). It copes with renamed properties files and directories because it uses the English properties files as a template (similar to po2prop -t). The generated properties files will go into the same directory as the corresponding English properties files.
  • Prop2GettextTask (prop2gettext) is like 'prop2po --duplicates=msgctxt' or 'msgcat --properties-input', except that it generates one POT for a directory tree of .properties (and/or one PO per locale)
  • Regex2PotTask (regex2pot) is like 'xgettext', but uses regexes to identify strings which should be extracted, rather than parsers for each supported language. Works in conjunction with WebGettext (see below)
  • !VerifyPropTask compares the contents of two .properties files and breaks the build if the names or values are different (used for testing Ant-Gettext)

Some tasks which might go away unless someone shows interest in them:

  • Po2EnTask is like 'poen' (generates English .po file from .pot)
  • Po2PropTask is like 'po2prop' or 'msgcat --properties-output' (generates .properties from .po)
  • Prop2PotTask is like 'prop2po --duplicates=msgctxt' or 'msgcat --properties-input' (generates .pot from default locale .properties, eg messages.properties -> messages.pot)
  • Prop2PoTask is like 'prop2po --duplicates=msgctxt' or 'msgcat --properties-input' (generates .po from translate .properties, eg messages_es.properties -> messages_es.po)
  • XPath2PotTask (xpath2pot) is like Regex2PotTask, but extracts values matching an XPath expression.

WebGettext (unmaintained)

Originated as a patch for the old JBoss consoles, and hasn't been properly documented.

Features: a. a method for localising strings in JSPs in the Gettext style (keeping English in the source JSP) b. an Ant task which can find such strings in JSPs and generate a Gettext POT file.

(a) is provided by WebGettext, which provides an EL resolver for expressions such as ${messages["Hello {0}"][username]}. The resolver looks up a translation, for the requesting user's locale, and substitutes any parameters using MessageFormat.

(b) is provided by Regex2PotTask (actually part of Ant-Gettext, not WebGettext), which is a bit like xgettext but rather than finding C, Java, Perl, etc, function calls such as gettext("my string"), it finds a configurable regex expression.

Example JSP project - see RUNNING.txt

History

Ant-Gettext was created by Red Hat's Internationalisation team in Brisbane, for use in JBoss projects, by allowing i18n tasks to be added to pure-Java build processes.

JGettext was created by Steve Ebersole as part of the Maven jDocBook plugin in the JBoss project.

Maintainer

Download

Tennera is made up of several jars, arranged in a Maven2 repository here: http://svn.fedorahosted.org/svn/tennera/m2repo/

Tennera's jars are all under: http://svn.fedorahosted.org/svn/tennera/m2repo/org/fedorahosted/tennera/

Irregular snapshots go here occasionally: http://seanf.fedorapeople.org/maven2/snapshot/

It's best if you can use something like Maven to pick up your dependencies (see below), but otherwise you can download the individual jars from http://svn.fedorahosted.org/svn/tennera/m2repo/org/fedorahosted/tennera/ You will also need ANTLR . If you're using Ant, Maven Ant Tasks can help with the dependencies.

Maven dependency details for pom.xml

<repositories>
    <repository>
        <name>Tennera release repository on fedorahosted.org</name>
        <id>fhosted.tennera.svn</id>
        <url>http://svn.fedorahosted.org/svn/tennera/m2repo/</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
<!--
    <repository>
      <name>Tennera snapshot repository on fedorapeople.org</name>
      <id>fpeople.tennera.snap</id>
      <url>http://seanf.fedorapeople.org/maven2/snapshot/</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
-->
</repositories>

<dependencies>
    <dependency>
        <groupId>org.fedorahosted.tennera</groupId>
        <artifactId>tennera</artifactId>
        <version>0.6</version>
    </dependency>
</dependencies>

NB: You might need to update the version numbers. And don't forget to uncomment the snapshot repo if you use snapshot versions!

Task definitions for Ant

Set up a classpath called "dependency.classpath" with the jars above, then:

<taskdef resource="org/fedorahosted/tennera/antgettext/antlib.xml" 
 classpathref="dependency.classpath" />

Licence

LGPL 2.1

org.fedorahosted.tennera

Zanata

Versions

Version
0.9
0.8
0.6
0.5
0.4
0.1