接口 DictI18nLoader


public interface DictI18nLoader
A unified interface for dictionary internationalization loader, defining the core methods that all loaders must implement.

This interface serves as the foundation of the platinized architecture for loaders in the dict-i18n framework. All built-in or custom loaders must implement this interface to ensure the system can uniformly schedule dictionary loading logic from different data sources.

Core responsibilities:

  • Define the unique identifier of the loader (loaderName()), used for configuration and priority control
  • Provide a standard method to query translation results based on language and dictionary key (get(String, String))

The implementation class needs to realize specific loading logic based on its own characteristics (such as files, databases, Redis, etc. data sources), and can enhance functionality by combining with extension components like caching and data parsing. The system will invoke each loader through this interface's unified contract in the order of configured priorities, achieving collaboration among multiple data sources.

  • 方法概要

    修饰符和类型
    方法
    说明
    get(String lang, String dictKey)
    Get translations based on language and key
    Loader name, should be unique
  • 方法详细资料

    • loaderName

      String loaderName()
      Loader name, should be unique
    • get

      Optional<String> get(String lang, String dictKey)
      Get translations based on language and key
      参数:
      lang - lowercase language
      dictKey - dictionary key
      返回:
      translation