Process Used From Ant Script

Describes the process control support from the command line for the G11NToolKit.

L10N Process Control

The Main Tasks in the Ant files are described below. The other tasks in the Ant files are used by other tasks in the Ant files and can be used if needed when writing extensions to the Ant files. The task name is shown in each task description. The task names are case sensitive and must be typed exactly as shown.

There are two environment variables that must be set in order for the tasks in this script to work properly:

  1. ANT_HOME
    - The home directory for the Ant product. We are currently using Ant 1.6.5. This is controlled by the Ant product and does not show as an environment variable.
  2. G11NTOOLKIT-DIR
    - The home directory for the G11NToolKit. This is the directory into which you installed the G11NToolKit. This you will have to set since the install task does not do it.

There is one property that may be set as an environment variable or set as a property in the user.properties file:

  1. ANT_CONTRIB_JAR
    - The path and file name for the Ant Contrib jar file. Ant Contrib is a set of add-on tasks for the Ant Product. We are currently using Ant Contrib 0.6. This you will have to set since there is no install task to do it.

Return to:   Top of page

Files Used in the Process Control Tasks

Throughout this section the ${...} notation will be used to indicate that variable information goes in this spot. When reading this section you should substitute the value you have set for the variable. For example, if you use the C:\myG11NToolKit directory as your install directory you will also set the G11NTOOLKIT-DIR environment variable to that directory name. When you see ${G11NTOOLKIT-DIR} in this section you can assume that the C:\myG11NToolKit directory name will be used in place of the variable.

There are two important XML files that are used in the L10N project:

  1. l10nproj.xml

    This file is a local shortcut to use the tasks in the L10NProcess.xml file. Make a copy of this file in your product work area. You may want to tailor the comments in this file to make the sample command lines more useful, but this is not necessary. You will find a model of this file in the ${G11NTOOLKIT-DIR}\L10NProcess directory.

  2. multiproj.xml

    If a product has been divided into sub projects, this file will be useful. The file can be tailored by changing the project list properties to suit the particular product. You may also want to tailor the comments again to make the command line samples more useful. The rest of the file is general enough to be used in any project. The L10NProcess.xml target you want to run is specified as the TARGET property on the command line except for the clean target which has a target in this file.

There are several XML files that contain the Ant rules for controlling the L10N Process. The main file is L10NProcess.xml. It contains the main Ant tasks that do all the work and some import statements that import the rest of the Ant rules for the detail work of the process. There is only one copy of this file kept in the ${G11NTOOLKIT-DIR}\L10NProcess directory. You do not need this file in a local product directory.

There are two properties files that are used to set the appropriate property values used in L10NProcess.xml.

  1. user.properites
    This file contains property values that are specific to the user's environment. The file should be copied from the
    ${G11NTOOLKIT-DIR}\L10NProcess
    directory to the product work area. Change the file name by replacing user with your user name or id. This will be entered on the command line so make it something that is easy to type and does not conflict with any other users for this product area. You will also need to set appropriate values for the properties listed in the file. The
    ANT_CONTRIB_JAR
    property can be set as an environment variable if you like. If you set it as an environment variable, remove it from your copy of this file. If an extensions package is used there may be other properties that need to be set. They can be added to the
    user.properties
    file if desired.
  2. Language_xx.properties
    This file contains property values that are specific to a language. Only one copy of this file is needed for each language. The full set of language files will be kept in the ${G11NTOOLKIT-DIR}\L10NProcess directory and loaded from there.

There are several properties that are used to control the process. These properties must have the right values in order to have the proper effect. Some property values are set on the command line, some in properties files, and others in the Ant files. There is a strict hierarchy for setting the property values. The first time a property value is set is the only time it can be set (properties in Ant are immutable) so the following list shows the order in which property values are set:

  1. command line (-DPROPNAME=propvalue)
  2. user.properties (PROPNAME=propvalue) - each user has a file like this for each product. The file name contains the user identification and is entered on the command line.
  3. Language_xx.properties (PROPNAME=propvalue) - each language has one of these files. The xx in the file name is replaced by a language code. These files are kept in the ${G11NTOOLKIT-DIR}\L10NProcess directory.
  4. multproj.xml (<property name="PROPNAME" value="propvalue"/>) - there is one of these files for each product that has been divided into multiple projects. This file controls the process for the entire product. A copy of this file is kept in the product work area directory.
  5. l10nproj.xml (<property name="PROPNAME" value="propvalue"/>) - there is one of these for each product. It is kept in the product work area directory. Property elements can be added to this file for properties that are needed for a particular product.
  6. L10NProcess-extensions.xml (<property name="PROPNAME" value="propvalue"/>) - there is only one copy of this file kept in the ${G11NTOOLKIT-DIR}\extensions\L10NProcess directory. The property values set in this file are the default values. The extensions package (if any) may add properties to this file as needed. If the extensions property names are the same as those used by the L10NProcess.xml file the extensions values will be used.
  7. L10NProcess.xml (<property name="PROPNAME" value="propvalue"/>) - there is only one copy of this file kept in the ${G11NTOOLKIT-DIR}\L10NProcess directory. The property values set in this file are the default values. If no other value is set then the value in this file will be used.

Return to:   Top of page

The L10N Process Control Tasks

The tasks in the process are run through the l10nproj.xml file. To use the main process tasks you set your current directory to the project directory and use the following command line entries one at a time:

ant -f l10nproj.xml -e -l pid-getsourcefiles.log getsourcefiles -DPROJECT=pid -DSOURCEFILESDIR=srcdir -DUSER=uid
Will copy the project source files from the
srcdir
directory to the product work area directory.
pid
should be replaced by the project identifier,
srcdir
should be replaced by the name of the directory that contains all the product source files listed in the project control file, and
uid
should be replaced by the user identifier that identifies the user properties file to be used. The
srcdir
will probably be a directory in your source code control system directory structure. You are responsible for making sure the directory contains the latest source files.
ant -f l10nproj.xml -e -l pid-tok.log tok -DPROJECT=pid -DUSER=uid
Will tokenize the source files listed in the project control file and create the extracted string files for translation.
pid
should be replaced by the project identifier and
uid
should be replaced by the user identifier that identifies the user properties file to be used.
ant -f l10nproj.xml -e -l pid_lang-detok.log detok -DLANGUAGE=lang -DPROJECT=pid -DUSER=uid
Will replace the extracted strings from the source files with their translated strings.
pid
should be replaced by the project identifier,
lang
should be replaced by the target language identifier, and
uid
should be replaced by the user identifier that identifies the user properties file to be used.
ant -f l10nproj.xml -e -l pid_lang-puttargetfiles.log puttargetfiles -DLANGUAGE=lang -DPROJECT=pid -DTARGETFILESDIR=tardir -DUSER=uid
Will copy the target files from the product work area to the product file structure in their appropriate directories as shown in the project control file. The directory used as
tardir
will probably be a directory in your source code control system directory structure. You are responsible for making the final commit to the source code control system.
pid
should be replaced by the project identifier,
lang
should be replaced by the target language identifier,
tardir
should be replaced with the directory name that will contain all the target files listed in the project control file, and
uid
should be replaced by the user identifier that identifies the user properties file to be used.
ant -f l10nproj.xml -e -DPROJECT=pid -l pid_lang-copysrctar.log copysrctar -DLANGUAGE=lang -DUSER=uid
Will copy the source files listed in the project control file to their target file names making any name changes as needed. No translation is provided except for the file names as shown in the project control file. You should use the getsourcefiles and puttargetfiles tasks in addition to this task to make sure you are dealing with the latest source files and that they are finally placed in the appropriate directory in your source code control system directory structure.
pid
should be replaced by the project identifier,
lang
should be replaced by the target language identifier, and
uid
should be replaced by the user identifier that identifies the user properties file to be used.

The details of the L10N Process rules are found in the following XML files which are all imported at run time:

L10NProcess.xml
Contains the main tasks as shown above.
L10NProcess-detoktasks.xml
Contains tasks for detokenizing the files to create the final translated target files.
L10NProcess-extensions.xml
Is a place holder for links to extensions that may be implemented by the user. When extensions are installed an import for the extensions main Ant file should be included in this file.
L10NProcess-filediscovery.xml
Contains tasks to help find the translatable files in a product.
L10NProcess-macros.xml
Contains Ant macros that are used by other tasks in the process.
L10NProcess-tasks.xml
Contains tasks that are general in nature and used in the process or depended upon by other tasks.
L10NProcess-toktasks.xml
Contains tasks for tokenizing the source files and creating the extracted string files.

Return to:   Top of page

by Bill Rich