Package com.collibra.dgc.workflow.api.bean

# 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 Type
  Method
  Description
  `String`
  `buildDefaultTranslations(String locale)`
  Builds a properties file with all the translation keys and the built-in values.
  `String`
  `fillTranslations(String locale, String value)`
  This will update the (override) translation file and add all keys that are not present yet.
  `List<Locale>`
  `getAllLocales()`
  Returns all the possible locales.
  `List<Locale>`
  `getAvailableLocales()`
  Returns a list of available locales.
  `List<Locale>`
  `getAvailableOverrideLocales()`
  Returns a list of locales that have overridden values.
  `String`
  `getCapitalizedMessage(String key, Object... params)`
  Get the capitalized message for the given key, using the given parameters and the current localization.
  `Locale`
  `getDefaultLocale()`
  Retrieve the default locale of the application.
  `String`
  `getMessage(String key, Object... params)`
  Get the message for the given key, using the given parameters and the current localization.
  `String`
  `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

    String getMessage(String key, 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 message
      `params` - 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

    String getCapitalizedMessage(String key, 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 message
      `params` - 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

    List<Locale> getAvailableLocales()
    Returns a list of available locales.
    Returns:
      The list of available locales.

  - ### getAllLocales

    List<Locale> getAllLocales()
    Returns all the possible locales.
    Returns:
      The list of all locales.

  - ### getAvailableOverrideLocales

    List<Locale> getAvailableOverrideLocales()
    Returns a list of locales that have overridden values.
    Returns:
      The list of available locales that have overrideen values.

  - ### buildDefaultTranslations

    String buildDefaultTranslations(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

    String fillTranslations(String locale, 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

    String getTranslationOverrides(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 wrong
      `com.collibra.common.exception.CollibraException` - if the translation file could not be read

  - ### setTranslationOverrides

    void setTranslationOverrides(String locale, 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 wrong
      `com.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