Class FormLanguageHelper


  • public final class FormLanguageHelper
    extends Object
    Helper methods related to the languages available for a form.
    Author:
    XIMA MEDIA GmbH
    • Method Detail

      • createAdditionalLanguages

        public static Map<String,​String> createAdditionalLanguages​(Locale locale)
        Parameters:
        locale - Locale to use for the display name of the languages.
        Returns:
        A map with additional languages available on the system. The key is the language tag, the value is the display name of the language.
      • createCombinedLanguages

        public static List<javax.faces.model.SelectItem> createCombinedLanguages​(Locale locale,
                                                                                 FormDesignerLanguageModel model)
        Parameters:
        locale - Locale to use for the display name of the languages.
        model - Form language model to use.
        Returns:
        A list with select items representing all languages from the given form model that can be selected in the UI.
      • createDefaultLanguages

        public static Map<String,​String> createDefaultLanguages​(Locale locale,
                                                                      Mandant client)
        Parameters:
        locale - Locale to use for the display name of the languages.
        client - Client scope for the I18N variables.
        Returns:
        A map with all languages from the I18N variables of the given client. Key is the language tag, the value is the display name of the language.
      • createExtraFormLanguagesMap

        public static Map<String,​String> createExtraFormLanguagesMap​(Locale locale,
                                                                           FormPersist persist)
        Parameters:
        locale - Locale for the display name of the locales.
        persist - A form persist with the form metadata and the items.
        Returns:
        A map with all languages from the given persist JSON. The key is the language tag, value the display name.
      • createFormLanguagesMap

        public static Map<String,​String> createFormLanguagesMap​(Locale locale,
                                                                      String persistJson)
        Parameters:
        locale - Locale for the display name of the locales.
        persistJson - A form persist JSON.
        Returns:
        A map with all languages from the given persist JSON. The key is the language tag, value the display name.
      • createLocaleDisplayName

        public static String createLocaleDisplayName​(Locale locale,
                                                     String tag)
        Parameters:
        locale - Locale with the language in which to render the language tag.
        tag - A language tag to process.
        Returns:
        The display name of the given language tag, e.g. German - Germany (de-DE).