java.lang.Object
io.github.palexdev.mfxlocalization.I18N
Class to handle internationalization.
To change the project's language you should use setLanguage(Language) before
loading any node (for example at the top of the Application.start(Stage) method).
-
Property Summary
Properties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic Stringstatic javafx.beans.binding.StringBindinggetBinding(String key, Object... args) static javafx.beans.binding.StringBindinggetBinding(Callable<String> callable) static Stringstatic LocaleGets the value of thelocaleproperty.static StringgetOrDefault(Language language, String key, Object... args) static StringgetOrDefault(Language language, String key, String def, Object... args) static StringgetOrDefault(String key, Object... args) static StringgetOrDefault(String key, String def, Object... args) static Language[]static javafx.beans.property.ObjectProperty<Locale>Specifies the current MaterialFX language.static voidsetLanguage(Language language)
-
Property Details
-
locale
Specifies the current MaterialFX language. NOTE: it is not recommended to set the Locale from this property, you should use the given setter,setLanguage(Language), since MaterialFX may not support all Locales.- See Also:
-
-
Constructor Details
-
I18N
public I18N()
-
-
Method Details
-
get
- Returns:
- the String associated with the given key.
The resource bundle used is loaded from the current specified locale,
localeProperty()
-
get
- Returns:
- the String associated with the given key. The resource bundle used is loaded from the specified language parameter
-
getOrDefault
- Returns:
- the String associated with the given key.
The resource bundle used is loaded from the current specified locale,
localeProperty()If the bundle doesn't provide any value for the given key, returns the value from the default language,Language.defaultLanguage()
-
getOrDefault
- Returns:
- the String associated with the given key.
The resource bundle used is loaded from the specified language parameter.
If the bundle doesn't provide any value for the given key, returns the value from the
default language,
Language.defaultLanguage()
-
getOrDefault
- Returns:
- the String associated with the given key.
The resource bundle used is loaded from the current specified locale,
localeProperty()If the bundle doesn't provide any value for the given key, returns the given def parameter
-
getOrDefault
- Returns:
- the String associated with the given key. The resource bundle used is loaded from the specified language parameter. If the bundle doesn't provide any value for the given key, returns the given def parameter
-
getBinding
- Returns:
- a
StringBindingthat updates whenever thelocaleProperty()changes. The localized String is loaded usinggetOrDefault(String, Object...)
-
getBinding
- Returns:
- a
StringBindingthat updates whenever thelocaleProperty()changes. The value is computed according to the givenCallable
-
getLocale
Gets the value of thelocaleproperty.- Property description:
- Specifies the current MaterialFX language.
NOTE: it is not recommended to set the Locale from this property, you
should use the given setter,
setLanguage(Language), since MaterialFX may not support all Locales. - Returns:
- the value of the
localeproperty - See Also:
-
localeProperty
Specifies the current MaterialFX language. NOTE: it is not recommended to set the Locale from this property, you should use the given setter,setLanguage(Language), since MaterialFX may not support all Locales.- Returns:
- the
localeproperty - See Also:
-
setLanguage
-
getSupportedLanguages
- Returns:
- all the supported languages
-
getBundleBaseName
- Returns:
- the
ResourceBundle's base name
-