Package passport.application.desktop
Class Translator
java.lang.Object
passport.application.desktop.Translator
Responsible for managing string translations at runtime. Note:
ObjectProperty
is used to allow dynamic content updates.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlanguage()
Returns the current language.void
Sets the current language and loads its respective ResourceBundle.javafx.beans.property.ObjectProperty
<Language> Current language as an ObjectProperty.Returns the current ResourceBundle.javafx.beans.property.ObjectProperty
<ResourceBundle> ResourceBundle as an ObjectProperty.translateFrom
(Consumer<String> textSetter, String property) Sets up the translation of a text, using a consumer to apply the translation.translationOf
(String property) Returns the translation of the specified property.
-
Constructor Details
-
Translator
public Translator()Initializes with the English language by default.
-
-
Method Details
-
language
Sets the current language and loads its respective ResourceBundle.- Parameters:
language
- The language to set.
-
translateFrom
Sets up the translation of a text, using a consumer to apply the translation.- Parameters:
textSetter
- The consumer that sets the translated text.property
- The translation property to be used.- Returns:
- The current instance of Translator.
-
translationOf
-
resources
Returns the current ResourceBundle.- Returns:
- The current ResourceBundle.
-
resourcesProp
ResourceBundle as an ObjectProperty.- Returns:
- The ResourceBundle property.
-
language
-
languageProp
Current language as an ObjectProperty.- Returns:
- The current language property.
-