Class XItemPropertyI18NUtils


  • public class XItemPropertyI18NUtils
    extends Object
    • Constructor Detail

      • XItemPropertyI18NUtils

        public XItemPropertyI18NUtils()
    • Method Detail

      • getBestLanguage

        public static String getBestLanguage​(IXFormRenderConfig config,
                                             com.alibaba.fastjson.JSONObject object,
                                             String propName)
        Given a language, searches for the closest language with an available translation for the given form element property. For example, if the form is to be rendered in the language fr-CA, this method first checks whether a translation is available for that language. If so, that language is returned. Otherwise, this method checks whether a translation is available for the language tag fr. If none is available either, the empty string is returned.
        Parameters:
        config - A form configuration with a language tag.
        object - A JSON object with the language tag as the key and another JSON object as the value. These JSON objects have the property name as the key and the localized text as the value.
        propName - Name of the (form element) property for which to find the localized text.
        Returns:
        The current language of the given form if a translation exists for that language, or a fallback language that has a translation.