Java Reference
In-Depth Information
specified, the string itself becomes the key into the locale properties file. For
example:
var postalCode = ## "Zip Code: ";
var postalCode = ##[postal]"Zip Code: ";
In the preceding example, using the first form, the key is
"Zip Code: "
, whereas
for the second form, the key is
"postal"
. So how does this work?
By default, the localizer searches for a property file for each unique script name.
This is the package name plus script filename with a locale and a file type of
.fxproperties
. So, if your script name is
com.mycompany.MyClass
, the localizer
code would look for a property file named
com/mycompany/MyClass_xx.
fxproperties
on the classpath, where
xx
is the locale. For example, for English
in the United Kingdom, the properties filename would be
com/mycompany/
MyClass_en_GB.fxproperties
, whereas French Canadian would be
com/mycom-
pany/MyClass_fr_CA.fxproperties
. If your default locale is just English, the
properties file would be
MyClass_en.fxproperties
.
The more specific file is
searched first, then the least specific file is consulted. For instance,
MyClass_
en_GB.fxproperties
is searched for the key and if it is not found, then
MyClass_en.fxproperties
would be searched. If the key cannot be found at all,
the string itself is used as the default. Here are some examples:
Example #1:
println(##"Thank you");
French - MyClass_fr.fxproperties:
"Thank you" = "Merci"
German - MyClass_de.fxproperties:
"Thank you" = "Danke"
Japanese - MyClass_ja.fxproperties:
"Thank you" = "Arigato"
Search WWH ::
Custom Search