public class CompositeDictI18nProvider extends Object implements DictI18nProvider
DictI18nLoader according to the
configuration order to achieve internationalization parsing and language degradation support for dictionary text.| 限定符和类型 | 字段和说明 |
|---|---|
static String |
FALLBACK_LOCALE_KEY |
| 构造器和说明 |
|---|
CompositeDictI18nProvider(DictLoaderSorter sorter)
Constructors, receive sequencers and configuration items, initialize loader lists.
|
| 限定符和类型 | 方法和说明 |
|---|---|
Optional<String> |
getText(String language,
String defaultLanguage,
String dictName,
String code)
Retrieve internationalized copy (dictionary text) for the specified language.
|
String |
resolveKey(String dictName,
String code)
Construct the dictionary key name for loader queries, typically formed by concatenating the dictionary name with the code.
|
public CompositeDictI18nProvider(DictLoaderSorter sorter)
sorter - A loader sequencer that controls the order in which the loader is executedpublic Optional<String> getText(String language, String defaultLanguage, String dictName, String code)
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 在接口中 DictI18nProviderlanguage - 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"public String resolveKey(String dictName, String code)
Example: dictName = "order_status", code = "pending", return "order_status.pending"
dictName - dictionary namecode - Dictionary key-value, such as "pending"Copyright © 2025. All rights reserved.