![]()
|
TranslateDescriptionIdentifies keys in files delimited by special tokens and translates them with values read from resource bundles. A resource bundle contains locale-specific key-value pairs. A resource bundle is a hierarchical set of property files. A bundle name makes up its base family name. Each file that makes up this bundle has this name plus its locale. For example, if the resource bundle name is MyResources, the file that contains German text will take the name MyResources_de. In addition to language, country and variant are also used to form the files in the bundle. The resource bundle lookup searches for resource files with various suffixes on the basis of (1) the desired locale and (2) the default locale (basebundlename), in the following order from lower-level (more specific) to parent-level (less specific): basebundlename + "_" + language1 + "_" + country1 + "_" + variant1 basebundlename + "_" + language1 + "_" + country1 basebundlename + "_" + language1 basebundlename basebundlename + "_" + language2 + "_" + country2 + "_" + variant2 basebundlename + "_" + language2 + "_" + country2 basebundlename + "_" + language2 The file names generated thus are appended with the string ".properties" to make up the file names that are to be used. File encoding is supported. The encoding scheme of the source files, destination files and the bundle files can be specified. Destination files can be exlicitly overwritten using the forceoverwrite attribute. If forceoverwrite is false, the destination file is overwritten only if either the source file or any of the files that make up the bundle have been modified after the destination file was last modified. FileSets are used to select files to translate. Parameters
Parameters specified as nested elementsfilesetFileSets are used to select files that contain keys for which value translated files are to be generated. ExamplesTranslate source file encoded in english into its japanese equivalent using a resource bundle encoded in japanese. <translate toDir="$(dest.dir}/ja" starttoken="#" endtoken="#" bundle="resource/BaseResource" bundlelanguage="ja" forceoverwrite="yes" srcencoding="ISO8859_1" destencoding="SJIS" bundleencoding="SJIS"> <fileset dir="${src.dir}"> <include name="**/*.jsp"/> </fileset> </translate> Copyright © 2001 Apache Software Foundation. All rights Reserved. |