{"id":30136490,"url":"https://github.com/silwings-git/dict-i18n","last_synced_at":"2026-03-17T23:06:16.664Z","repository":{"id":306798578,"uuid":"1014887075","full_name":"Silwings-git/dict-i18n","owner":"Silwings-git","description":"A Spring Boot starter for dictionary-based i18n, automatically injecting multilingual descriptions for code fields with flexible data source support.","archived":false,"fork":false,"pushed_at":"2025-10-13T14:25:14.000Z","size":472,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-07T00:36:47.173Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Silwings-git.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-06T15:48:56.000Z","updated_at":"2026-01-29T08:09:24.000Z","dependencies_parsed_at":"2025-07-27T18:45:08.273Z","dependency_job_id":null,"html_url":"https://github.com/Silwings-git/dict-i18n","commit_stats":null,"previous_names":["silwings-git/dict-i18n"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Silwings-git/dict-i18n","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Silwings-git%2Fdict-i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Silwings-git%2Fdict-i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Silwings-git%2Fdict-i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Silwings-git%2Fdict-i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Silwings-git","download_url":"https://codeload.github.com/Silwings-git/dict-i18n/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Silwings-git%2Fdict-i18n/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30635156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T22:38:22.569Z","status":"ssl_error","status_checked_at":"2026-03-17T22:38:11.804Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-10T23:09:13.669Z","updated_at":"2026-03-17T23:06:16.656Z","avatar_url":"https://github.com/Silwings-git.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dict-I18n\n\n[中文](./docs/zh/README.zh-CN.md) | [English](README.md)\n\n[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/Silwings-git/dict-i18n)\n\n📹 [Introduction video](https://www.bilibili.com/video/BV1pStVzeEm4/) —— Quickly understand the framework's core features and integration process\n\n`dict-i18n` is a solution for internationalizing (i18n) domain data codes (such as order statuses, product types, etc.)\nbased on dictionaries. It deeply integrates with the Spring Boot ecosystem, supports loading dictionaries from multiple\ndata sources, automatically injects localized text into Java objects and REST responses, simplifies the management of\nmultilingual descriptions, and is suitable for scenarios with fixed or infrequently changing coded data.\n\n## 🌟 Core Values\n\nFocuses on addressing the pain points of **internationalizing domain-coded data**, filling the gap in coding mapping\nscenarios for traditional resource bundles:\n\n- **Unified Dictionary Management**: Replaces hard-coded multilingual descriptions, standardizes dictionary definitions\n  through enums/Java Beans, and supports loading from files, databases, Redis, etc.\n- **Automatic Internationalization Enhancement**: Leverages the `@DictDesc` annotation to automatically inject localized\n  text corresponding to codes into JSON responses, eliminating the need for manual mapping handling.\n- **Flexible Extension and Adaptation**: Modular design (core, loaders, auto-configuration, etc.) supports custom\n  loaders and language providers for complex business needs.\n- **Strict Validation Assurance**: Validates the uniqueness of dictionary names at startup, supports cycle detection\n  during recursive object scanning, and avoids runtime conflicts.\n\n## 📚 Documentation Navigation\n\n| Category                   | Description                                                             | Document Link                                                                   |  \n|----------------------------|-------------------------------------------------------------------------|---------------------------------------------------------------------------------|  \n| Feature Introduction       | Core features of the framework                                          | [Home.md](./docs/en/Home.md)                                                    |  \n| Quick Start                | Core capabilities and minimal integration process                       | [Quick Start.md](./docs/en/guide/Quick_Start.md)                                |  \n| Loader Architecture        | Design and extension mechanisms of multi-source loaders                 | [Loader Instructions.md](./docs/en/loader/Loader_Instructions.md)               |  \n| Auto-Configuration Details | Starter auto-assembly process and configuration items                   | [Starter Instructions.md](./docs/en/starter/Starter_Instructions.md)            |  \n| Configuration Guide        | Configuration items for dictionary scanning, endpoints, enhancers, etc. | [Configuration Instructions.md](./docs/en/config/Configuration_Instructions.md) |  \n| Frequently Asked Questions | Typical issues and solutions during integration and use                 | [FAQs.md](./docs/en/faq/FAQs.md)                                                |  \n\n## ✨ Core Features\n\n### 1. Flexible Dictionary Definition\n\nSupports defining dictionaries by **implementing the `Dict` interface with enums/Java Beans**, covering scenarios such\nas static coding and dynamic loading:\n\n```java  \n// Enum example  \npublic enum OrderStatus implements Dict {\n  PENDING(\"pending\"),\n  COMPLETED(\"completed\");\n\n  private final String code;\n\n  @Override\n  public String dictName() {\n    // Unique identifier for the dictionary  \n    return \"order_status\";\n  }\n\n  @Override\n  public String code() {\n    return this.code;\n  }\n}  \n```  \n\n### 2. Multi-source Loading and Priority\n\nBuilt-in loaders for **files (YAML/Properties), databases, Redis, and declarative** sources. Supports configuring\nloading priority via `loader-order`:\n\n```yaml  \ndict-i18n:\n  loader-order:\n    - redis  # Redis loader takes precedence  \n    - sql    # Database loader comes next  \n    - file   # File loader as a fallback  \n```  \n\n### 3. Automatic Response Enhancement\n\nUse the `@DictDesc` annotation in DTOs to mark fields that need description injection, specifying the associated\ndictionary enum:\n\n```java  \npublic class OrderDTO {\n  private String status;\n\n  // Automatically inject the internationalized description corresponding to status  \n  @DictDesc(OrderStatus.class)\n  private String statusDesc;\n}\n\n// Response example  \n{\n    \"status\":\"pending\",\n    \"statusDesc\":\"Pending\" // Or return the corresponding language description based on language configuration  \n}  \n```  \n\n### 4. Strict Startup Validation\n\nAutomatically validates the **uniqueness of dictionary names** at startup to avoid conflicts caused by multiple enums\nreusing the same dictionary name:\n\n```java  \n// Conflict example (triggers an error at startup)  \npublic enum OrderState implements Dict {\n  PENDING(\"pending\");\n\n  @Override\n  public String dictName() {\n    return \"order_status\"; // Conflicts with the dictionary name of OrderStatus  \n  }\n}  \n```  \n\n## 🚀 Quick Start\n\n### 1. Add Dependencies\n\nAdd `dict-i18n-spring-boot-starter` to `pom.xml` (automatically integrates core, loaders, and other modules):\n\n```xml  \n\n\u003cdependency\u003e\n    \u003cgroupId\u003ecn.silwings.dicti18n\u003c/groupId\u003e\n    \u003cartifactId\u003edict-i18n-spring-boot-starter\u003c/artifactId\u003e\n    \u003cversion\u003e2.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n\n\u003c!-- Add loaders as needed (at least one) --\u003e\n\u003c!-- Static declaration loader --\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003ecn.silwings.dicti18n\u003c/groupId\u003e\n    \u003cartifactId\u003edict-i18n-loader-declared\u003c/artifactId\u003e\n    \u003cversion\u003e2.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n\n\u003c!-- Redis loader --\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003ecn.silwings.dicti18n\u003c/groupId\u003e\n    \u003cartifactId\u003edict-i18n-loader-redis\u003c/artifactId\u003e\n    \u003cversion\u003e2.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n\n\u003c!-- Database loader --\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003ecn.silwings.dicti18n\u003c/groupId\u003e\n    \u003cartifactId\u003edict-i18n-loader-sql\u003c/artifactId\u003e\n    \u003cversion\u003e2.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n\n\u003c!-- File loader (YAML/Properties) --\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003ecn.silwings.dicti18n\u003c/groupId\u003e\n    \u003cartifactId\u003edict-i18n-loader-file\u003c/artifactId\u003e\n    \u003cversion\u003e2.0.0\u003c/version\u003e\n\u003c/dependency\u003e  \n```  \n\n### 2. Define Dictionary Enums\n\nImplement the `Dict` interface with an enum, declaring the **dictionary name (`dictName`)** and **code (`code`)**:\n\n```java  \npublic enum OrderStatus implements Dict {\n    PENDING(\"pending\"),\n    COMPLETED(\"completed\");\n\n    private final String code;\n\n    @Override\n    public String dictName() {\n      return \"order_status\"; // Unique identifier for the dictionary, associated with multilingual configurations  \n    }\n\n    @Override\n    public String code() {\n        return this.code;\n    }\n\n  // Constructor and Getters are omitted...  \n}  \n```  \n\n### 3. Enable Internationalization Enhancement\n\nMark fields in DTOs that need description injection with `@DictDesc`, specifying the associated dictionary enum:\n\n```java  \npublic class OrderDTO {\n    private String status;\n\n  // Automatically inject the internationalized description corresponding to status  \n    @DictDesc(OrderStatus.class)\n    private String statusDesc;\n\n  // Getters/Setters are omitted...  \n}  \n```  \n\n### 4. Configure Dictionary Sources (Taking File Loader as an Example)\n\nOptionally configure loading priority in `application.yml`:\n\n```yaml  \ndict-i18n:\n  loader-order:\n    - file  # File loader takes precedence  \n\n# Dictionary content example (dict-i18n/dict_en.yml)  \norder_status:\n  pending: Pending\n  completed: Completed  \n```  \n\n### 5. Verify the Result\n\nReturn `OrderDTO` via a Controller, and the JSON response will automatically inject the localized description\ncorresponding to the code:\n\n```json  \n{\n  \"status\": \"pending\",\n  \"statusDesc\": \"Pending\"\n}  \n```  \n\n## 📦 Module Structure\n\n| Module Name                        | Description                                                                               |  \n|------------------------------------|-------------------------------------------------------------------------------------------|  \n| `dict-i18n-core`                   | Core interfaces (`Dict`/`Loader`), processors, and basic logic                            |  \n| `dict-i18n-loader`                 | Implementations of multi-source loaders (files, databases, Redis, etc.)                   |  \n| `dict-i18n-generator-maven-plugin` | Maven plugin, supports dictionary file generation and synchronization                     |  \n| `dict-i18n-spring-boot-starter`    | Spring Boot auto-configuration, REST endpoints, and response enhancement                  |  \n| `dict-i18n-demo`                   | Sample project covering enum definition, multi-source loading, response enhancement, etc. |  \n\n## 🔗 More Details\n\nThe complete documentation can be found in the project’s `docs` directory:\n\n- Loader extension (custom data sources), dynamic dictionary\n  updates → [Loader Instructions](./docs/en/loader/Loader_Instructions.md)\n- Spring Boot auto-configuration principles, using REST\n  endpoints → [Starter Instructions](./docs/en/starter/Starter_Instructions.md)\n- Complete configuration items (dictionary scanning, endpoints,\n  enhancers) → [Configuration Instructions](./docs/en/config/Configuration_Instructions.md)\n\nFor issues, submit an [Issue](https://github.com/Silwings-git/dict-i18n/issues) or contact the maintainers.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilwings-git%2Fdict-i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsilwings-git%2Fdict-i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilwings-git%2Fdict-i18n/lists"}