| Modifier and Type | Field and Description |
|---|---|
| private String | bundle
Family name of resource bundle |
| private static final int | BUNDLE_DEFAULT_LANGUAGE
search a bundle matching the language only of the current locale of the computer |
| private static final int | BUNDLE_DEFAULT_LANGUAGE_COUNTRY
search a bundle matching the language, and the country of the current locale of the computer |
| private static final int | BUNDLE_DEFAULT_LANGUAGE_COUNTRY_VARIANT
search a bundle matching the language, the country and the variant of the current locale of the computer |
| private static final int | BUNDLE_MAX_ALTERNATIVES
number of possibilities for the search |
| private static final int | BUNDLE_NOMATCH
search a bundle matching nothing special |
| private static final int | BUNDLE_SPECIFIED_LANGUAGE
search a bundle matching the specified language only |
| private static final int | BUNDLE_SPECIFIED_LANGUAGE_COUNTRY
search a bundle matching the specified language, and the country |
| private static final int | BUNDLE_SPECIFIED_LANGUAGE_COUNTRY_VARIANT
search a bundle matching the specified language, the country and the variant |
| private String | bundleCountry
Locale specific country of the resource bundle |
| private String | bundleEncoding
Resource Bundle file encoding scheme, defaults to srcEncoding |
| private String | bundleLanguage
Locale specific language of the resource bundle |
| private long[] | bundleLastModified
Last Modified Timestamp of resource bundle file being used. |
| private String | bundleVariant
Locale specific variant of the resource bundle |
| private String | destEncoding
Destination file encoding scheme |
| private long | destLastModified
Last Modified Timestamp of destination file being used. |
| private String | endToken
Ending token to identify keys |
| private static final FileUtils | FILE_UTILS
Used to resolve file names. |
| private List | filesets
Vector to hold source file sets. |
| private boolean | forceOverwrite
Whether or not to create a new destination file. |
| private boolean | loaded
Has at least one file from the bundle been loaded? |
| private Map | resourceMap
Holds key value pairs loaded from resource bundle file |
| private String | srcEncoding
Source file encoding scheme |
| private long | srcLastModified
Last Modified Timestamp of source file being used. |
| private String | startToken
Starting token to identify keys |
| private File | toDir
Destination directory |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addFileset(FileSet
the fileset to be added set)Adds a set of files to translate as a nested fileset element. |
| public void | execute()
Overrides org. |
| private void | |
| private void | |
| private void | processBundle(final String bundleFile, final int i, final boolean checkLoaded)
Process each file that makes up this bundle. |
| public void | |
| public void | setBundleCountry(String
country of the bundle bundleCountry)Sets locale specific country of resource bundle; optional. |
| public void | setBundleEncoding(String
bundle file encoding scheme bundleEncoding)Sets Resource Bundle file encoding scheme; optional. |
| public void | setBundleLanguage(String
language of the bundle bundleLanguage)Sets locale specific language of resource bundle; optional. |
| public void | setBundleVariant(String
locale variant of resource bundle bundleVariant)Sets locale specific variant of resource bundle; optional. |
| public void | setDestEncoding(String
destination file encoding scheme destEncoding)Sets destination file encoding scheme; optional. |
| public void | setEndToken(String
ending token to identify keys endToken)Sets ending token to identify keys; required. |
| public void | setForceOverwrite(boolean
whether or not to overwrite existing files forceOverwrite)Whether or not to overwrite existing file irrespective of whether it is newer than the source file as well as the resource bundle file. |
| public void | setSrcEncoding(String
source file encoding srcEncoding)Sets source file encoding scheme; optional, defaults to encoding of local system. |
| public void | setStartToken(String
starting token to identify keys startToken)Sets starting token to identify keys; required. |
| public void | |
| private void | translate()
Reads source file line by line using the source encoding and searches for keys that are sandwiched between the startToken and endToken. |
| private void |
| bundle | back to summary |
|---|---|
| private String bundle Family name of resource bundle | |
| BUNDLE_DEFAULT_LANGUAGE | back to summary |
|---|---|
| private static final int BUNDLE_DEFAULT_LANGUAGE search a bundle matching the language only of the current locale of the computer | |
| BUNDLE_DEFAULT_LANGUAGE_COUNTRY | back to summary |
|---|---|
| private static final int BUNDLE_DEFAULT_LANGUAGE_COUNTRY search a bundle matching the language, and the country of the current locale of the computer | |
| BUNDLE_DEFAULT_LANGUAGE_COUNTRY_VARIANT | back to summary |
|---|---|
| private static final int BUNDLE_DEFAULT_LANGUAGE_COUNTRY_VARIANT search a bundle matching the language, the country and the variant of the current locale of the computer | |
| BUNDLE_MAX_ALTERNATIVES | back to summary |
|---|---|
| private static final int BUNDLE_MAX_ALTERNATIVES number of possibilities for the search | |
| BUNDLE_NOMATCH | back to summary |
|---|---|
| private static final int BUNDLE_NOMATCH search a bundle matching nothing special | |
| BUNDLE_SPECIFIED_LANGUAGE | back to summary |
|---|---|
| private static final int BUNDLE_SPECIFIED_LANGUAGE search a bundle matching the specified language only | |
| BUNDLE_SPECIFIED_LANGUAGE_COUNTRY | back to summary |
|---|---|
| private static final int BUNDLE_SPECIFIED_LANGUAGE_COUNTRY search a bundle matching the specified language, and the country | |
| BUNDLE_SPECIFIED_LANGUAGE_COUNTRY_VARIANT | back to summary |
|---|---|
| private static final int BUNDLE_SPECIFIED_LANGUAGE_COUNTRY_VARIANT search a bundle matching the specified language, the country and the variant | |
| bundleCountry | back to summary |
|---|---|
| private String bundleCountry Locale specific country of the resource bundle | |
| bundleEncoding | back to summary |
|---|---|
| private String bundleEncoding Resource Bundle file encoding scheme, defaults to srcEncoding | |
| bundleLanguage | back to summary |
|---|---|
| private String bundleLanguage Locale specific language of the resource bundle | |
| bundleLastModified | back to summary |
|---|---|
| private long[] bundleLastModified Last Modified Timestamp of resource bundle file being used. | |
| bundleVariant | back to summary |
|---|---|
| private String bundleVariant Locale specific variant of the resource bundle | |
| destEncoding | back to summary |
|---|---|
| private String destEncoding Destination file encoding scheme | |
| destLastModified | back to summary |
|---|---|
| private long destLastModified Last Modified Timestamp of destination file being used. | |
| endToken | back to summary |
|---|---|
| private String endToken Ending token to identify keys | |
| FILE_UTILS | back to summary |
|---|---|
| private static final FileUtils FILE_UTILS Used to resolve file names. | |
| filesets | back to summary |
|---|---|
| private List<FileSet> filesets Vector to hold source file sets. | |
| forceOverwrite | back to summary |
|---|---|
| private boolean forceOverwrite Whether or not to create a new destination file.
Defaults to | |
| loaded | back to summary |
|---|---|
| private boolean loaded Has at least one file from the bundle been loaded? | |
| resourceMap | back to summary |
|---|---|
| private Map<String, String> resourceMap Holds key value pairs loaded from resource bundle file | |
| srcEncoding | back to summary |
|---|---|
| private String srcEncoding Source file encoding scheme | |
| srcLastModified | back to summary |
|---|---|
| private long srcLastModified Last Modified Timestamp of source file being used. | |
| startToken | back to summary |
|---|---|
| private String startToken Starting token to identify keys | |
| toDir | back to summary |
|---|---|
| private File toDir Destination directory | |
| Translate | back to summary |
|---|---|
| public Translate() | |
| addFileset | back to summary |
|---|---|
| public void addFileset(FileSet set) Adds a set of files to translate as a nested fileset element.
| |
| execute | back to summary |
|---|---|
| public void execute() throws BuildException Overrides org. Check attributes values, load resource map and translate
| |
| loadResourceMap | back to summary |
|---|---|
| private void loadResourceMap(InputStream ins) throws BuildException Load resourceMap with key value pairs. Values of existing keys are not overwritten. Bundle's encoding scheme is used. | |
| loadResourceMaps | back to summary |
|---|---|
| private void loadResourceMaps() throws BuildException Load resource maps based on resource bundle encoding scheme. 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 To the generated name, a ".properties" string is appended and once this file is located, it is treated just like a properties file but with bundle encoding also considered while loading. | |
| processBundle | back to summary |
|---|---|
| private void processBundle(final String bundleFile, final int i, final boolean checkLoaded) throws BuildException Process each file that makes up this bundle. | |
| setBundle | back to summary |
|---|---|
| public void setBundle(String bundle) Sets Family name of resource bundle; required.
| |
| setBundleCountry | back to summary |
|---|---|
| public void setBundleCountry(String bundleCountry) Sets locale specific country of resource bundle; optional.
| |
| setBundleEncoding | back to summary |
|---|---|
| public void setBundleEncoding(String bundleEncoding) Sets Resource Bundle file encoding scheme; optional. Defaults to source file encoding
| |
| setBundleLanguage | back to summary |
|---|---|
| public void setBundleLanguage(String bundleLanguage) Sets locale specific language of resource bundle; optional.
| |
| setBundleVariant | back to summary |
|---|---|
| public void setBundleVariant(String bundleVariant) Sets locale specific variant of resource bundle; optional.
| |
| setDestEncoding | back to summary |
|---|---|
| public void setDestEncoding(String destEncoding) Sets destination file encoding scheme; optional. Defaults to source file encoding
| |
| setEndToken | back to summary |
|---|---|
| public void setEndToken(String endToken) Sets ending token to identify keys; required.
| |
| setForceOverwrite | back to summary |
|---|---|
| public void setForceOverwrite(boolean forceOverwrite) Whether or not to overwrite existing file irrespective of whether it is newer than the source file as well as the resource bundle file. Defaults to false.
| |
| setSrcEncoding | back to summary |
|---|---|
| public void setSrcEncoding(String srcEncoding) Sets source file encoding scheme; optional, defaults to encoding of local system.
| |
| setStartToken | back to summary |
|---|---|
| public void setStartToken(String startToken) Sets starting token to identify keys; required.
| |
| setToDir | back to summary |
|---|---|
| public void setToDir(File toDir) Sets Destination directory; required.
| |
| translate | back to summary |
|---|---|
| private void translate() throws BuildException Reads source file line by line using the source encoding and searches for keys that are sandwiched between the startToken and endToken. The values for these keys are looked up from the hashtable and substituted. If the hashtable doesn't contain the key, they key itself is used as the value. Destination files and directories are created as needed. The destination file is overwritten only if the forceoverwritten attribute is set to true if the source file or any associated bundle resource file is newer than the destination file. | |
| translateOneFile | back to summary |
|---|---|
| private void translateOneFile(File src, File dest) throws IOException | |