2006-09-11 04:19:00 +00:00
|
|
|
<!--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
2001-11-02 23:30:44 +00:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
2002-02-03 22:11:39 +00:00
|
|
|
<title>Translate Task</title>
|
2001-11-02 23:30:44 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<h2><a name="translate">Translate</a></h2>
|
|
|
|
<h3>Description</h3>
|
|
|
|
<p>Identifies keys in files delimited by special tokens
|
|
|
|
and translates them with values read from resource bundles.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
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.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
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):
|
|
|
|
</p>
|
|
|
|
<pre>
|
|
|
|
basebundlename + "_" + language1 + "_" + country1 + "_" + variant1
|
|
|
|
basebundlename + "_" + language1 + "_" + country1
|
|
|
|
basebundlename + "_" + language1
|
|
|
|
basebundlename
|
|
|
|
basebundlename + "_" + language2 + "_" + country2 + "_" + variant2
|
|
|
|
basebundlename + "_" + language2 + "_" + country2
|
|
|
|
basebundlename + "_" + language2
|
|
|
|
</pre>
|
|
|
|
<p>
|
|
|
|
The file names generated thus are appended with the string ".properties"
|
|
|
|
to make up the file names that are to be used.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
File encoding is supported. The encoding scheme of the source files,
|
|
|
|
destination files and the bundle files can be specified.
|
|
|
|
|
2003-07-19 14:58:48 +00:00
|
|
|
Destination files can be explicitly overwritten using the
|
2001-11-02 23:30:44 +00:00
|
|
|
<var>forceoverwrite</var> attribute. If <var>forceoverwrite</var>
|
|
|
|
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.
|
|
|
|
</p>
|
2003-07-19 14:58:48 +00:00
|
|
|
<p>
|
2005-04-29 18:58:16 +00:00
|
|
|
<em>New in Ant 1.6:</em><br>
|
2003-07-19 14:58:48 +00:00
|
|
|
Line endings of source files are preserved in the translated files.
|
|
|
|
</p>
|
2001-11-02 23:30:44 +00:00
|
|
|
<p><a href="../CoreTypes/fileset.html">FileSet</a>s are used to select files to
|
|
|
|
translate.
|
|
|
|
</p>
|
|
|
|
<h3>Parameters</h3>
|
|
|
|
<table border="1" cellpadding="2" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<td valign="top"><b>Attribute</b></td>
|
|
|
|
<td valign="top"><b>Description</b></td>
|
|
|
|
<td align="center" valign="top"><b>Required</b></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">todir</td>
|
|
|
|
<td valign="top">Destination directory where destination files are
|
|
|
|
to be created.</td>
|
|
|
|
<td valign="top" align="center">Yes</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">starttoken</td>
|
|
|
|
<td valign="top">The starting token to identify keys.</td>
|
|
|
|
<td valign="top" align="center">Yes</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">endtoken</td>
|
|
|
|
<td valign="top">The ending token to identify keys.</td>
|
|
|
|
<td valign="top" align="center">Yes</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">bundle</td>
|
|
|
|
<td valign="top">Family name of resource bundle.</td>
|
|
|
|
<td valign="top" align="center">Yes</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">bundlelanguage</td>
|
|
|
|
<td valign="top">
|
|
|
|
Locale specific language of resource bundle. Defaults to
|
|
|
|
default locale's language.
|
|
|
|
</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">bundlecountry</td>
|
|
|
|
<td valign="top">
|
|
|
|
Locale specific country of resource bundle. Defaults to
|
|
|
|
default locale's country.
|
|
|
|
</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">bundlevariant</td>
|
|
|
|
<td valign="top">
|
|
|
|
Locale specific variant of resource bundle. Defaults to
|
|
|
|
the default variant of the country and language being used.
|
|
|
|
</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">srcencoding</td>
|
|
|
|
<td valign="top">Source file encoding scheme. Defaults to
|
|
|
|
system default file encoding.</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">destencoding</td>
|
|
|
|
<td valign="top">Destination file encoding scheme. Defaults to
|
|
|
|
source file encoding.</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">bundleencoding</td>
|
|
|
|
<td valign="top">Resource Bundle file encoding scheme. Defaults to
|
|
|
|
source file encoding.</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">forceoverwrite</td>
|
|
|
|
<td valign="top">Overwrite existing files even if the destination
|
|
|
|
files are newer. Defaults to "no".</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<h3>Parameters specified as nested elements</h3>
|
|
|
|
|
|
|
|
<h4>fileset</h4>
|
|
|
|
<p><a href="../CoreTypes/fileset.html">FileSets</a> are used to select files that
|
|
|
|
contain keys for which value translated files are to be generated.
|
|
|
|
</p>
|
|
|
|
<h3>Examples</h3>
|
|
|
|
<p><b>Translate source file encoded in english into its japanese
|
|
|
|
equivalent using a resource bundle encoded in japanese.
|
|
|
|
</b></p>
|
|
|
|
<pre>
|
|
|
|
<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>
|
2001-11-22 01:55:10 +00:00
|
|
|
</pre>
|
2006-09-11 04:33:25 +00:00
|
|
|
|
2001-11-22 01:55:10 +00:00
|
|
|
</body>
|
|
|
|
</html>
|