类 CompositeDictI18nProvider
java.lang.Object
cn.silwings.dicti18n.provider.CompositeDictI18nProvider
- 所有已实现的接口:
DictI18nProvider
A multi-dictionary loader combination provider that aggregates multiple
DictI18nLoader according to the
configuration order to achieve internationalization parsing and language degradation support for dictionary text.-
字段概要
字段 -
构造器概要
构造器构造器说明Constructors, receive sequencers and configuration items, initialize loader lists. -
方法概要
修饰符和类型方法说明Retrieve internationalized copy (dictionary text) for the specified language.resolveKey(String dictName, String code) Construct the dictionary key name for loader queries, typically formed by concatenating the dictionary name with the code.
-
字段详细资料
-
FALLBACK_LOCALE_KEY
- 另请参阅:
-
-
构造器详细资料
-
CompositeDictI18nProvider
Constructors, receive sequencers and configuration items, initialize loader lists.- 参数:
sorter- A loader sequencer that controls the order in which the loader is executed
-
-
方法详细资料
-
getText
public Optional<String> getText(String language, String defaultLanguage, String dictName, String code) Retrieve internationalized copy (dictionary text) for the specified language. Supports language fallback lookup (e.g., zh-CN -> zh) and also supports default language and fallback language configuration.The search order is as follows (in the sequence of loaders): 1. Search from the fallback chain of the current language (e.g., en-US -> en) 2. If not found, attempt to search using the configured default language (defaultLang). 3. If still not found, try looking it up with the special fallback key ("").
Once any step in a loader successfully finds a result, it immediately returns that result.
- 指定者:
getText在接口中DictI18nProvider- 参数:
language- User language, such as "en-US", "zh-CN"defaultLanguage- Default language, such as "en-US", "zh-CN"dictName- Dictionary name, such as "order_status"code- Dictionary keys, such as "pending"- 返回:
- The dictionary description in the corresponding language, or returns Optional.empty() if not found.
-
resolveKey
Construct the dictionary key name for loader queries, typically formed by concatenating the dictionary name with the code.Example: dictName = "order_status", code = "pending", return "order_status.pending"
- 参数:
dictName- dictionary namecode- Dictionary key-value, such as "pending"- 返回:
- spliced key name
-