Package de.xima.fc.form.common
Class XItemPropertyI18NUtils
- java.lang.Object
-
- de.xima.fc.form.common.XItemPropertyI18NUtils
-
public class XItemPropertyI18NUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description XItemPropertyI18NUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.static String
getI18NValue(XItem xitem, IXFormRenderConfig config, XPropertyEnum xProperty)
static String
getI18NValue(IXFormRenderConfig config, com.alibaba.fastjson.JSONObject json, String defaultValue, XPropertyEnum property)
static String
getI18NValueR(IXFormRenderConfig config, com.alibaba.fastjson.JSONObject json, String defaultValue, XPropertyEnum property)
static String
getI18NValueR(IXFormRenderConfig config, XPropertyEnum property, String defaultValue, XItemRenderData properties)
static String
getI18NValueR(IXFormRenderConfig config, String property, String defaultValue, XItemRenderData properties)
static String
replaceI18NAndEmptyValue(String value, IXFormRenderConfig config)
-
-
-
Method Detail
-
replaceI18NAndEmptyValue
public static String replaceI18NAndEmptyValue(String value, IXFormRenderConfig config)
-
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 languagefr-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 tagfr
. 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.
-
getI18NValueR
public static String getI18NValueR(IXFormRenderConfig config, XPropertyEnum property, String defaultValue, XItemRenderData properties)
-
getI18NValueR
public static String getI18NValueR(IXFormRenderConfig config, String property, String defaultValue, XItemRenderData properties)
-
getI18NValueR
public static String getI18NValueR(IXFormRenderConfig config, com.alibaba.fastjson.JSONObject json, String defaultValue, XPropertyEnum property)
-
getI18NValue
public static String getI18NValue(XItem xitem, IXFormRenderConfig config, XPropertyEnum xProperty)
-
getI18NValue
public static String getI18NValue(IXFormRenderConfig config, com.alibaba.fastjson.JSONObject json, String defaultValue, XPropertyEnum property)
-
-