Interface WorkflowTranslation
-
public interface WorkflowTranslation
A bean providing i18n (translation) related functionality. This will be available as 'translation' in your workflow expressions.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
buildDefaultTranslations(java.lang.String locale)
Builds a properties file with all the translation keys and the built-in values.java.lang.String
fillTranslations(java.lang.String locale, java.lang.String value)
This will update the (override) translation file and add all keys that are not present yet.java.util.List<java.util.Locale>
getAllLocales()
Returns all the possible locales.java.util.List<java.util.Locale>
getAvailableLocales()
Returns a list of available locales.java.util.List<java.util.Locale>
getAvailableOverrideLocales()
Returns a list of locales that have overridden values.java.lang.String
getCapitalizedMessage(java.lang.String key, java.lang.Object... params)
Get the capitalized message for the given key, using the given parameters and the current localization.java.util.Locale
getDefaultLocale()
Retrieve the default locale of the application.java.lang.String
getMessage(java.lang.String key, java.lang.Object... params)
Get the message for the given key, using the given parameters and the current localization.java.lang.String
getTranslationOverrides(java.lang.String locale)
Provides the translation overrides of a specific language.void
setTranslationOverrides(java.lang.String locale, java.lang.String translations)
Override and save the translations of the given locale.
-
-
-
Method Detail
-
getMessage
java.lang.String getMessage(java.lang.String key, java.lang.Object... params)
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
java.lang.String getCapitalizedMessage(java.lang.String key, java.lang.Object... params)
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
java.util.List<java.util.Locale> getAvailableLocales()
Returns a list of available locales.- Returns:
- The list of available locales.
-
getAllLocales
java.util.List<java.util.Locale> getAllLocales()
Returns all the possible locales.- Returns:
- The list of all locales.
-
getAvailableOverrideLocales
java.util.List<java.util.Locale> getAvailableOverrideLocales()
Returns a list of locales that have overridden values.- Returns:
- The list of available locales that have overrideen values.
-
buildDefaultTranslations
java.lang.String buildDefaultTranslations(java.lang.String locale)
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
java.lang.String fillTranslations(java.lang.String locale, java.lang.String value)
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
java.lang.String getTranslationOverrides(java.lang.String locale)
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
void setTranslationOverrides(java.lang.String locale, java.lang.String translations)
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
java.util.Locale getDefaultLocale()
Retrieve the default locale of the application.- Returns:
- the default locale
-
-