| CARVIEW |
|
transcoder
|
| Summary | Checks multingual resources for completeness. |
|---|---|
| Categories | None |
| License | Apache License, Version 2.0 |
| Owner(s) | lexi |
Transcoder Maven2 Plugin
Introduction
The Transcoder plugin for Maven2 is used to check multilingual resources for the completeness of translation. This plugin analyzes property files contained within the application and reports entries which were not translated into one of the required languages. Missing entries are written into property files in some target directory.
In practice, if you develop a multi-lingual project, you may need to be sure that you've translated all the language entries into all of the required languages. In case your language resources are distributed among multiple JARs, this may be hard to do. The Transcoder plugin performs the in-depth check of your JARs/resources and generates a list of properties yet-to-be-translated.
Usage
-
Add dev.java.net Maven2 repository into the list of plugin repositories of your project.
<project ...> <!-- ... --> <pluginRepositories> <pluginRepository> <id>maven2-repository.dev.java.net</id> <url>https://maven2-repository.dev.java.net/nonav/repository</url> </pluginRepository> </pluginRepositories> <!-- ... --> </project> -
Include the plugin into your build:
<project ...> <!-- ... --> <build> <plugins> <!-- ... --> <plugin> <groupId>org.jvnet.transcoder</groupId> <artifactId>maven-transcoder-plugin</artifactId> <version>0.1.107</version> <executions> <execution> <goals> <goal>verify</goal> </goals> </execution> </executions> <configuration> <locales> <locale>en</locale> <locale>de</locale> <locale>...</locale> </locales> <resources> <resource>messages</resource> <resource>com/acme/foo/messages</resource> <resource>...</resource> </resources> <missingResourceRegex>@@.*(TODO|todo).*@@</missingResourceRegex> </configuration> </plugin> <!-- ... --> </plugins> </build> <!-- ... --> </project>
Configuration
-
locales/locale - Configures the list of languages.
-
resources/resource - Configures the list resource names to check. Resource names are
provided without the
_locale.propertiessuffix. -
missingResourceRegex - A regular expression for the values of "todo" entries. If an entry is present but its value matches thid "todo" regex, it will still be considered missing.
-
target - Target directory where the property files for missing entries
will be generated. By default,
${project.build.directory}/missing-resources.
User guide, questions and answers
- How is the check performed?
-
The plugin is configured with a list of languages (locales) and a list of resource names. It also implicitly knows runtime dependencies of the project. So the Transcoder plugin checks that:
- for every runtime dependency and every resource name,
- if certain entry exists in resource property file for one of the configured languages,
- then it exists in resource property files for all of the configured languages (within the same dependency).
- What is the output?
-
The plugin has the
targetconfiguration parameter${project.build.directory}/missing-resourcesby default. In case resource file within some given dependency misses some entries for one of the languages, they will be written into the${target}/${groupId}/${artifactId}/${resourceName}_${locale}.propertiesfile.${target}is the target directory (see above),${groupId}and${artifactId}are the group id and the artifact id of the given dependency,${resourceName}and${locale}are current resource name and language.Example. Consider we're missing the German
user.username(locale:de) entry in the resourcede/disy/preludio2/messagesof thede.disy.preludio2:preludio2-shared. In this case we'll get the filetarget/missing-resources/de.disy.preludio2/preludio2-shared/de/disy/preludio2/messages_de.propertiescontaining something like:user.username=@@TODO.user.username@@ - Which entries are considered "missing"?
-
When the plugin checks resources for completeness, it first collects all the entry codes contained in resource property files for all configured languages for given dependency/resource name. Then it checks property files for each of the languages. If certain entry is missing in one of the property files, or is present but the value matches the
missingResourceRegex(typically a dummy@@todo@@marker value), then the value is considered missing. - What exactly is checked?
-
The plugin checks available runtime dependencies of the project. Each of the dependencies will be resolver into a JAR file, the plugin will then create a class loader with the URL of this JAR and use this classloader to resolve resources.
| Powered by CollabNet | Feedback |
FAQ |
Press |
Developer tools
© 1995 - 2007 CollabNet. CollabNet is a registered trademark of CollabNet, Inc. |
