Java Reference
In-Depth Information
Example #2:
println(##[ThankKey] "Thank you");
French - MyClass_fr.fxproperties:
"ThankKey" = "Merci"
German - MyClass_de.fxproperties:
"ThankKey" = "Danke"
Japanese - MyClass_ja.fxproperties:
"ThankKey" = "Arigato"
When you use a string with an embedded expression, the literal key contains a
%s
, where the expression is located within the string. For example:
println(##"Hello, my name is {firstname}");
In this case, the key is
"Hello, my name is %s"
. Likewise, if you use more
than one expression, the key contains a
"%s"
for each expression:
println(##"Hello, my name is {firstname} {lastname}");
Now, the key is
"Hello, my name is %s %s"
.
This parameter substitution is also used in the translated strings. For example:
French - MyClass_fr.fxproperties:
"Hello, my name is %s %s" = "Bonjour, je m'appelle %s %s"
Lastly, you can associate another Properties file to the script. This is done using
the
javafx.util.StringLocalizer
class. For example:
StringLocalizer.associate("com.mycompany.resources.MyResources",
"com.mycompany");
Now, all translation lookups for scripts in the
com.mycompany
package will look for
the properties file
com/mycompany/resources/MyResources_xx.fxproperties
,
instead of using the default that uses the script name. Again,
xx
is replaced with
the locale abbreviation codes.
Search WWH ::
Custom Search