My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
New_Features_Version_1_3  
overview of new features and configuration options in v1.3.
Featured, Phase-Implementation
Updated Feb 6, 2010 by savage7....@gmail.com

Introduction

This page describes the new features and options added to version 1.3.

Details

Version 1.3 introduces new features including

  • console progress display to show the current translation cycle status
  • overriding source properties file name
  • output file encoding options
  • exclusion list of named properties to exclude from generated output files
  • comment header for generated output files
  • smart-sync feature to limit translation effort to only added and changed properties
  • pass-thru list of named properties to include in the generated output files, but not translate

The following configuration parameters have been added to support the new features exposed in version 1.3. Please see the details for each parameter below.

A new sample project has been included to demonstrate all of the new version 1.3 features: google-api-translate-java-maven-plugin-test-UTF8


showProgress

If enabled, the console output will display a progress percentage complete, language X of Y, and property X of Y status information while the translation generation is processing.

To enable this feature, add the following node under the plugin configuration in the POM file.

  <configuration>
    ...
    <showProgress>true</showProgress>

sourceTranslationFile

This configuration parameter allows overriding the default source property file naming convention. If this parameter is included in your POM, the file name specified will be used as the source property file name. To enable this feature, add the following node under the plugin configuration in the POM file and specify a file name for the source properties file.

  <configuration>
    ...
    <sourceTranslationFile>Language.properties</sourceTranslationFile>

destinationFileEncoding

This configuration parameter allows overriding the default system file encoding when creating the destination output property files. If this parameter is included in your POM, the file encoding specified will be used for all generated output property files.

Please note that the default Java Properties reader/writer only supports '8859_1' encoding by default. There are work-arounds and other external tools such as the Spring Framework that can read properties files encoded in alternate encoding formats such as UTF-8 and UTF-16.

Note: as of Java 1.6 there are overloaded methods for load() and store() that accept a Reader/Writer argument. Using this you can create a FileInputStream and InputStreamReader using an alternate encoding.

Supported Encodings:

  • ASCII
  • Cp1252
  • ISO8859_1, ISO-8859_1
  • UTF8, UTF-8
  • UTF-16
  • UTF-16BE, UnicodeBigUnmarked
  • UTF-16LE, UnicodeLittleUnmarked
  • UnicodeBig
  • UnicodeLittle
To enable this feature, add the following node under the plugin configuration in the POM file and specify which file encoding to use.

  <configuration>
    ...
    <destinationFileEncoding>UTF-8</destinationFileEncoding>

destinationFileEncodingIncludeBOM

This configuration parameter is used in conjunction with the 'destinationFileEncoding' parameter and allows a forced inclusion of byte-order-marker (BOM) bytes in the generated output destination property files.

Note: This option is really only useful when needing to include the BOM bytes for UTF-8 encoding.

This option will only apply to the following encodings:

  • UTF8, UTF-8
  • UTF-16BE, UnicodeBigUnmarked
  • UTF-16LE, UnicodeLittleUnmarked
To enable this feature, add the following node under the plugin configuration in the POM file.

  <configuration>
    ...
    <destinationFileEncodingIncludeBOM>true</destinationFileEncodingIncludeBOM>

excludeProperties

This configuration parameter allows a set of named properties that exist in the source properties file to be excluded from the generated output property files.

To enable this feature, add the following node under the plugin configuration in the POM file and include the property name/keys that you wish to exclude.

  <configuration>
    ...
    <excludeProperties>
       <param>test-exclude-1</param>
       <param>test-exclude-2</param>
    </excludeProperties>

commentHeader

This configuration parameter allows a comment string to be defined that will be included in the header of all generated output property files.

Note: This comment string is not translated for the destination language

To enable this feature, add the following node under the plugin configuration in the POM file.

  <configuration>
    ...
    <commentHeader>
       <![CDATA[
##############################################################################
  MY LOCALIZED RESOURCE FILES
  (auto-generated)
###############################################################################           
       ]]>     
    </commentHeader>

smartSync

If 'smartSync' is enabled then only detected changes in the source file will be processed for each destination file. This option can significantly reduce the amount of processing time since only detected changes are translated. If 'smartSync' is disabled, then all destination property values are re-translated each time this tool is executed. If an existing destination files exists, then it will be analyzed to determine which if any property values are missing or have changed. Only these missing and changed property values are translated, existing unchanged property values will remain untouched and any source properties that have been removed will also be removed from the destination files.

NOTE: This option is used in conjunction with the 'smartSyncChangeFile' configuration parameter. If the 'smartSyncChangeFile' parameter is not defined, then only property values added to and removed from the source file will be propagated to the destination files. The change file defined by 'smartSyncChangeFile' is used to detect value changes for all existing source properties.

To enable this feature, add the following node under the plugin configuration in the POM file.

  <configuration>
    ...
    <smartSync>true</smartSync>

smartSyncChangeFile

This option extends the smart-sync feature to support the ability to determine changed source property value strings and only translate these changes. The 'smartSync' option must be enabled to take advantage of this feature. This parameter defines a file name that will be created in the destination path and used on subsequent translation cycles to determine which source property values have changed.

To enable this feature, add the following node under the plugin configuration in the POM file and define the filename for the smart sync change file.

  <configuration>
    ...
    <smartSyncChangeFile>
       smart-sync.history
    </smartSyncChangeFile>

passThruProperties

This configuration parameter allows a set of named properties that exist in the source properties file that should be included in the generated output property files but should not be translated.

To enable this feature, add the following node under the plugin configuration in the POM file and include the property name/keys that you wish to pass-thru.

  <configuration>
    ...
    <passThruProperties>
       <param>test-pass-thru-1</param>
       <param>test-pass-thru-2</param>
    </passThruProperties>

Comment by project member systemsp...@gmail.com, Feb 6, 2010

Really nice job Robert!

Comment by project member savage7....@gmail.com, Feb 6, 2010

Thank You! I am using most of these new options in a current project. Having all this automated with Maven makes this task very streamlined for our development process.


Sign in to add a comment
Powered by Google Project Hosting