Package io.openems.edge.core.appmanager
Class TranslationUtil
java.lang.Object
io.openems.edge.core.appmanager.TranslationUtil
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
static final class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Disables the debug mode.Enables the debug mode for getting translations.static String
getNullableTranslation
(ResourceBundle translationBundle, String key, Object... params) Gets the value for the given key from the translationBundle.static String
getTranslation
(ResourceBundle translationBundle, String key, Object... params) Gets the value for the given key from the translationBundle.static String
translate
(ResourceBundle translationBundle, String key, Object... params) Gets the value for the given key from the translationBundle.
-
Constructor Details
-
TranslationUtil
public TranslationUtil()
-
-
Method Details
-
enableDebugMode
Enables the debug mode for getting translations.- Returns:
- the
TranslationUtil.DebugTranslator
to get debug metrics.
-
disableDebugMode
public static void disableDebugMode()Disables the debug mode. -
getTranslation
Gets the value for the given key from the translationBundle.- Parameters:
translationBundle
- the translation bundlekey
- the key of the translationparams
- the parameter of the translation- Returns:
- the translated string or the key if the translation was not found or the format is invalid
-
translate
Gets the value for the given key from the translationBundle.- Parameters:
translationBundle
- the translation bundlekey
- the key of the translationparams
- the parameter of the translation- Returns:
- the translated string or the key if the translation was not found or the format is invalid
-
getNullableTranslation
public static String getNullableTranslation(ResourceBundle translationBundle, String key, Object... params) Gets the value for the given key from the translationBundle.- Parameters:
translationBundle
- the translation bundlekey
- the key of the translationparams
- the parameter of the translation- Returns:
- the translated string or null if the translation was not found or the format is invalid
-