Spec-Zone .ru
спецификации, руководства, описания, API

JavaFX: Bringing Rich Experiences To All the Screens Of Your Life

Profile: desktop, common

Overview

Utility class for localizing strings using JavaFX properties files. An object of this class is used to find the appropriate localized strings for the given variables. For example,

 // Object creation
 var localizer = StringLocalizer{ key: "Hello, World!" };

 // This prints localized text for "Hello, World!" for the default locale
 System.out.println(localizer.localizedString);

 // This prints localized text for "Duke" for the default locale
 localizer.key = "Duke";
 System.out.println(localizer.localizedString);
 
By default, translations are retrieved from the JavaFX properties file which has the same package and file name as the caller's script file. For example, a call from the script foo.bar.Example will search translated strings from foo/bar/Example_xx.fxproperties where 'xx' represents the locale. By calling associate()/dissociate() functions, different JavaFX properties files can be used for the translation. For example,

 StringLocalizer.associate("foo.bar.resources.MyResources", "foo.bar");
 
After this call, all the translations from JavaFX script files in foo.bar package are searched in foo/bar/resources/MyResources_xx.fxproperties, where 'xx' denotes the default locale.

Profile: desktop

This comment needs review.

Variable Summary

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
publicdefaultStringString

The default string for the localizedString.

publickeyString

The string that represents the 'key' in the JavaFX properties file

publiclocalizedStringString

The localized string for the given variables.

The localized string for the given variables. If there is no appropriate localized string found in JavaFX properties files, this variable will have the value in defaultString if it is specified, otherwise it will have the value in key.

This comment needs review.

 

Inherited Variables

Script Function Summary

public associate(properties: java.lang.String, packageName: java.lang.String) : Void

Associates a JavaFX package with a JavaFX properties file.

Associates a JavaFX package with a JavaFX properties file. If an association is made, further localizations in the source script files in the specified package will be searched within the specified JavaFX properties file.

This comment needs review.

Parameters
properties
denotes the canonical base name of the JavaFX properties file, e.g., 'foo.bar.MyResources'.
packageName
denotes the JavaFX package name, e.g., 'foo.bar'.

Profile: desktop

 
public associate(properties: java.lang.String, packageName: java.lang.String, scriptFileName: java.lang.String) : Void

Associates a JavaFX Script source file with a JavaFX properties file.

Associates a JavaFX Script source file with a JavaFX properties file. If an association is made, further localizations in the specified source script file will be searched within the specified JavaFX properties file.

This comment needs review.

Parameters
properties
denotes the canonical base name of the JavaFX properties file, e.g., 'foo.bar.MyResources'.
packageName
denotes the JavaFX package name of the source script file, e.g., 'foo.bar'.
scriptFileName
the file name of the source script file, e.g., 'Example.fx'.

Profile: desktop

 
public dissociate(packageName: java.lang.String) : Void

Dissociates a JavaFX package from any JavaFX properties file.

Dissociates a JavaFX package from any JavaFX properties file.

This comment needs review.

Parameters
packageName
denotes the JavaFX package name, e.g., 'foo.bar'.

Profile: desktop

 
public dissociate(packageName: java.lang.String, scriptFileName: java.lang.String) : Void

Dissociates a JavaFX Script source file from any JavaFX properties file.

Dissociates a JavaFX Script source file from any JavaFX properties file.

This comment needs review.

Parameters
packageName
denotes the JavaFX package name, e.g., 'foo.bar'.
scriptFileName
the file name of the source script file, e.g., 'Example.fx'.

Profile: desktop

 

Inherited Functions