Interface WorkflowTranslation
public interface WorkflowTranslation
A bean providing i18n (translation) related functionality. This will be available as 'translation'
in your workflow expressions.
-
Method Summary
Modifier and TypeMethodDescriptionbuildDefaultTranslations
(String locale) Builds a properties file with all the translation keys and the built-in values.fillTranslations
(String locale, String value) This will update the (override) translation file and add all keys that are not present yet.Returns all the possible locales.Returns a list of available locales.Returns a list of locales that have overridden values.getCapitalizedMessage
(String key, Object... params) Get the capitalized message for the given key, using the given parameters and the current localization.Retrieve the default locale of the application.getMessage
(String key, Object... params) Get the message for the given key, using the given parameters and the current localization.getTranslationOverrides
(String locale) Provides the translation overrides of a specific language.void
setTranslationOverrides
(String locale, String translations) Override and save the translations of the given locale.
-
Method Details
-
getMessage
Get the message for the given key, using the given parameters and the current localization.If the localized (e.g. fr_FR) message cannot be found for the key, it looks at the message for the same language (e.g. fr). If this message is not found, it check the default localization of the message and after at the English ('en') version of the message.
- Parameters:
key
- The key of the messageparams
- The parameters of the message- Returns:
- The found
String
message or the key if it was not found or null if the key was null.
-
getCapitalizedMessage
Get the capitalized message for the given key, using the given parameters and the current localization.If the localized (e.g. fr_FR) message cannot be found for the key, it looks at the message for the same language (e.g. fr). If this message is not found, it check the default localization of the message and after at the English ('en') version of the message.
- Parameters:
key
- The key of the messageparams
- The parameters of the message- Returns:
- The found
String
message or the key if it was not found or null if the key was null. The value is capitalized if possible.
-
getAvailableLocales
Returns a list of available locales.- Returns:
- The list of available locales.
-
getAllLocales
Returns all the possible locales.- Returns:
- The list of all locales.
-
getAvailableOverrideLocales
Returns a list of locales that have overridden values.- Returns:
- The list of available locales that have overrideen values.
-
buildDefaultTranslations
Builds a properties file with all the translation keys and the built-in values.- Parameters:
locale
- The locale to do this for. If not specified, the default 'en' will be taken.- Returns:
- The generated properties file.
- Throws:
com.collibra.common.exception.CollibraIllegalArgumentException
- if a parameter was missing or wrong
-
fillTranslations
This will update the (override) translation file and add all keys that are not present yet. For keys that are added, the values of the closest matching build-in language is used.- Parameters:
locale
- The language to update the translations for.value
- The current value. If not set, the known (saved) value is taken.- Returns:
- The updated file.
- Throws:
com.collibra.common.exception.CollibraIllegalArgumentException
- if a parameter was missing or wrong
-
getTranslationOverrides
Provides the translation overrides of a specific language.- Parameters:
locale
- The locale to get the translations for.- Returns:
- The found translation overrides.
- Throws:
com.collibra.common.exception.CollibraIllegalArgumentException
- if a parameter was missing or wrongcom.collibra.common.exception.CollibraException
- if the translation file could not be read
-
setTranslationOverrides
Override and save the translations of the given locale.- Parameters:
locale
- The locale to override.translations
- The new translations for the given locale.- Throws:
com.collibra.common.exception.CollibraIllegalArgumentException
- if a parameter was missing or wrongcom.collibra.common.exception.CollibraException
- if the translation file could not be written
-
getDefaultLocale
Locale getDefaultLocale()Retrieve the default locale of the application.- Returns:
- the default locale
-