Class TranslatableText
java.lang.Object
velox.gui.utils.localization.translatable.TranslatableText
- All Implemented Interfaces:
TranslatableComponent
You can use this class instead of
This class support chainging with other TranslatableComponent classes when they passed as arguments
For a convenient use, extend this class with you own add-on specific class with a constructor that will call super constructor with a specific bundleName and classLoader (to not pass the bundleName and classLoader explicitly every time you create a new instance of TranslatableText)
LocalizedBundle.getString(String key, Map args)
if the given text can be used on several locales at the same time. This class support chainging with other TranslatableComponent classes when they passed as arguments
For a convenient use, extend this class with you own add-on specific class with a constructor that will call super constructor with a specific bundleName and classLoader (to not pass the bundleName and classLoader explicitly every time you create a new instance of TranslatableText)
- See Also:
-
- DemoStrategies see velox.api.layer1.simpledemo.localization.LocalizedAlertDemoTranslatableText class for an example
-
Constructor Summary
ConstructorsConstructorDescriptionTranslatableText(String key, String bundleName, ClassLoader classLoader, boolean throwException) Get locale specific text by given key, without argumentsTranslatableText(String key, Map<String, Object> args, String bundleName, ClassLoader classLoader, boolean throwException) Get locale specific text by given key, and insert given arguments -
Method Summary
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface velox.gui.utils.localization.translatable.TranslatableComponent
toDefaultString, toLocalizedString
-
Constructor Details
-
TranslatableText
public TranslatableText(String key, Map<String, Object> args, String bundleName, ClassLoader classLoader, boolean throwException) Get locale specific text by given key, and insert given arguments- Parameters:
key- translation keyargs- named arguments that should inserted in textbundleName- in which key is locatedclassLoader- with which your classes were loaded from the jarthrowException- if true we throw an exception if the key is not found in the given bundleName, otherwise return the key as is
-
TranslatableText
public TranslatableText(String key, String bundleName, ClassLoader classLoader, boolean throwException) Get locale specific text by given key, without arguments- Parameters:
key- translation keybundleName- in which key is locatedclassLoader- with which your classes were loaded from the jarthrowException- if true we throw an exception if the key is not found in the given bundleName, otherwise return the key as is
-
-
Method Details
-
getKey
- Returns:
- translationKey
-
toLocalizedString
- Specified by:
toLocalizedStringin interfaceTranslatableComponent- Returns:
- localized string in specific locale
-
hashCode
public int hashCode() -
equals
-
toString
-