{"id":47806070,"url":"https://github.com/leycm/i18label4j","last_synced_at":"2026-04-03T17:38:30.618Z","repository":{"id":344654451,"uuid":"1182556330","full_name":"leycm/i18label4j","owner":"leycm","description":"A fast, server-side translation and label provider for high-performance Text \u0026 MiniMessage localization","archived":false,"fork":false,"pushed_at":"2026-04-01T12:41:11.000Z","size":334,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-04-01T14:48:20.527Z","etag":null,"topics":["4j","adventure-api","i18n","java","java21","kotlin","minimessage","papermc"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leycm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.LGPL","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-15T17:17:38.000Z","updated_at":"2026-04-01T12:41:15.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/leycm/i18label4j","commit_stats":null,"previous_names":["leycm/i18label4j"],"tags_count":1,"template":false,"template_full_name":"leycm/gradle-template","purl":"pkg:github/leycm/i18label4j","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leycm%2Fi18label4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leycm%2Fi18label4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leycm%2Fi18label4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leycm%2Fi18label4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leycm","download_url":"https://codeload.github.com/leycm/i18label4j/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leycm%2Fi18label4j/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31366371,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T17:13:05.644Z","status":"ssl_error","status_checked_at":"2026-04-03T17:13:04.413Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["4j","adventure-api","i18n","java","java21","kotlin","minimessage","papermc"],"created_at":"2026-04-03T17:38:29.883Z","updated_at":"2026-04-03T17:38:30.601Z","avatar_url":"https://github.com/leycm.png","language":"Java","readme":"\u003c!-- Back to top --\u003e\n\u003ca id=\"readme-top\"\u003e\u003c/a\u003e\n\n\u003c!-- PROJECT SHIELDS --\u003e\n[![Contributors][contributors-shield]][contributors-url]\n[![Forks][forks-shield]][forks-url]\n[![Stargazers][stars-shield]][stars-url]\n[![Issues][issues-shield]][issues-url]\n[![LGPL License][license-shield]][license-url]\n\n\u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003ei18label4j\u003c/h1\u003e\n\n  \u003cp align=\"center\"\u003e\n    A simple and lightweight registry library with flexible identifiers and namespaces for Java.\u003cbr/\u003e\n    Localize your application cleanly — with typed labels, dynamic placeholders, and pluggable serializers.\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/leycm/i18label4j\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\n    \u0026nbsp;·\u0026nbsp;\n    \u003ca href=\"https://github.com/leycm/i18label4j/issues/new?labels=bug\"\u003eReport Bug\u003c/a\u003e\n    \u0026nbsp;·\u0026nbsp;\n    \u003ca href=\"https://github.com/leycm/i18label4j/issues/new?labels=enhancement\"\u003eRequest Feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n---\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n\u003cdetails\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\n  \u003col\u003e\n    \u003cli\u003e\u003ca href=\"#about-the-project\"\u003eAbout The Project\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\n      \u003ca href=\"#getting-started\"\u003eGetting Started\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#prerequisites\"\u003ePrerequisites\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#architecture\"\u003eArchitecture\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#roadmap\"\u003eRoadmap\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contact\"\u003eContact\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#acknowledgments\"\u003eAcknowledgments\u003c/a\u003e\u003c/li\u003e\n  \u003c/ol\u003e\n\u003c/details\u003e\n\n---\n\n## About The Project\n\n**i18label4j** is a modular Java library for managing localizable text labels with a clean, fluent API. It provides:\n\n- **Typed labels** — distinguish between locale-aware i18n labels and immutable literal labels at compile time.\n- **Placeholder substitution** — register static or dynamic `Mapping` objects on any label and apply them via configurable `MappingRule` strategies (supports `${key}`, `{key}`, `%key%`, `\u003ckey\u003e`, and more out of the box).\n- **Pluggable serializers** — convert labels to any target type (plain `String`, Adventure `Component`, etc.) by registering a `LabelSerializer`.\n- **Multiple localization sources** — load translations from a flat directory (`FileSource`), a nested directory tree (`DirSource`), or implement your own `LocalizationSource`.\n- **Format support** — JSON, YAML, TOML, and Java `.properties` files are supported out of the box.\n- **Translation caching** — the `CommonLabelProvider` caches translations per locale with thread-safe `ConcurrentHashMap` internals and explicit cache eviction.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n### Built With\n\n- [![Java][java-badge]][java-url]\n- [![Gradle][gradle-badge]][gradle-url]\n- [![Lombok][lombok-badge]][lombok-url]\n- [SnakeYAML](https://bitbucket.org/snakeyaml/snakeyaml) · [toml4j](https://github.com/moandjiezana/toml4j) · [org.json](https://github.com/stleary/JSON-java)\n- [Adventure API](https://docs.advntr.net/) *(optional serializer target)*\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n---\n\n## Getting Started\n\n### Prerequisites\n\n- Java 21+\n- Gradle 9+ (wrapper included)\n\n### Installation\n\nAdd the repository and dependency to your `build.gradle.kts`:\n\n```kotlin\nrepositories {\n    maven(\"https://leycm.github.io/repository/\")\n}\n\ndependencies {\n    // API only (compile against the interface)\n    compileOnly(\"de.leycm:i18label4j-api:1.0\")\n\n    // Full implementation (includes CommonLabelProvider, FileSource, DirSource, etc.)\n    implementation(\"de.leycm:i18label4j-impl:1.0\")\n}\n```\n\nOr with Maven (`pom.xml`):\n\n```xml\n\u003crepository\u003e\n  \u003cid\u003eleycm-repo\u003c/id\u003e\n  \u003curl\u003ehttps://leycm.github.io/repository/\u003c/url\u003e\n\u003c/repository\u003e\n\n\u003cdependency\u003e\n  \u003cgroupId\u003ede.leycm\u003c/groupId\u003e\n  \u003cartifactId\u003ei18label4j-api\u003c/artifactId\u003e\n  \u003cversion\u003e1.0\u003c/version\u003e\n  \u003cscope\u003eprovided\u003c/scope\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n  \u003cgroupId\u003ede.leycm\u003c/groupId\u003e\n  \u003cartifactId\u003ei18label4j-impl\u003c/artifactId\u003e\n  \u003cversion\u003e1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n---\n\n## Usage\n\n### 1. Set up a `LabelProvider`\n\n```java\n// Load translations from a flat directory of JSON files:\n// resources/lang/en.json, de.json, ...\nLocalizationSource source = FileSource.json(\n    URI.create(\"resource://lang\")\n);\n\nLabelProvider provider = CommonLabelProvider.builder()\n    .locale(Locale.ENGLISH)                      // default locale\n    .defaultMappingRule(MappingRule.DOLLAR_CURLY) // ${placeholder} syntax\n    .withSerializer(String.class, new MyStringSerializer())\n    .buildWarm(source, Locale.ENGLISH, Locale.GERMAN); // pre-load cache\n\n// Register as singleton\nInstanceable.register(provider, LabelProvider.class);\n```\n\n### 2. Create and resolve labels\n\n```java\n// Translatable label — looks up \"greeting\" in the active locale\nLabel hello = Label.of(\"greeting\");\nSystem.out.println(hello.in(Locale.ENGLISH)); // -\u003e \"Hello!\"\nSystem.out.println(hello.in(Locale.GERMAN));  // -\u003e \"Hallo!\"\n\n// Literal label — always returns the fixed string\nLabel version = Label.literal(\"v1.0.0\");\nSystem.out.println(version.in(Locale.JAPANESE)); // -\u003e \"v1.0.0\"\n```\n\n### 3. Placeholder substitution\n\n```java\nLabel message = Label.of(\"welcome.message\")\n    .mapTo(\"name\", () -\u003e currentUser.getDisplayName())\n    .mapTo(\"count\", itemCount);\n\n// Translation: \"Welcome, ${name}! You have ${count} items.\"\nSystem.out.println(message.mapped(Locale.ENGLISH));\n// -\u003e \"Welcome, Alice! You have 3 items.\"\n```\n\n### 4. Serialize to a custom type\n\n```java\n// Assuming an Adventure Component serializer is registered:\nComponent component = Label.of(\"server.motd\").serialize(Component.class);\n```\n\n### 5. Translation file layout (`FileSource`)\n\n```\nresources/lang/\n  en.json      -\u003e {\"greeting\": \"Hello!\", \"welcome.message\": \"Welcome, ${name}!\"}\n  de.json      -\u003e {\"greeting\": \"Hallo!\", \"welcome.message\": \"Willkommen, ${name}!\"}\n```\n\n### 6. Nested directory layout (`DirSource`)\n\n```\nresources/lang/\n  en/\n    messages.json  -\u003e {\"greeting\": \"Hello!\"}\n    errors.json    -\u003e {\"not_found\": \"Not found.\"}\n  de/\n    messages.json  -\u003e {\"greeting\": \"Hallo!\"}\n```\n\nKeys are prefixed with the filename stem: `messages.greeting`, `errors.not_found`.\n\n### Available `MappingRule` styles\n\n| Constant | Example |\n|---|---|\n| `MappingRule.DOLLAR_CURLY` | `${variable}` |\n| `MappingRule.CURLY` | `{variable}` |\n| `MappingRule.DOUBLE_CURLY` | `{{variable}}` |\n| `MappingRule.PERCENT` | `%variable%` |\n| `MappingRule.TAG` | `\u003cvariable\u003e` |\n| `MappingRule.SHELL` | `$variable` |\n| `MappingRule.MINI_MESSAGE` | `\u003cvar:variable\u003e` |\n| ... | ... |\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n---\n\n## Architecture\n\n```\ni18label4j\n├── i18-api/          # Public API — Label, LabelProvider, Mapping, MappingRule, LabelSerializer, LocalizationSource\n└── i18-impl/         # Implementation — CommonLabelProvider, LiteralLabel, LocaleLabel,\n                      #                  FileSource, DirSource, FileParser, FileUtils\n```\n\nThe library is split into two modules so downstream projects can depend only on the API and swap implementations at runtime via `Instanceable.register(...)`.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n---\n\n## Roadmap\n\n- [x] Core `Label` API with `LiteralLabel` and `LocaleLabel`\n- [x] `CommonLabelProvider` with thread-safe translation cache\n- [x] `MappingRule` with 10+ built-in placeholder styles\n- [x] `FileSource` and `DirSource` with JSON, YAML, TOML, `.properties` support\n- [x] Classpath (`resource://`), filesystem (`file://`), and remote (`http(s)://`) URI schemes\n- [x] Nested/hierarchical key support in `DirSource`\n- [x] Hot-reload support for translation files\n- [ ] Maven / Gradle plugin for compile-time key validation\n- [ ] Additional serializer modules (Adventure, MiniMessage)\n\nSee the [open issues](https://github.com/leycm/i18label4j/issues) for the full list of proposed features and known bugs.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n---\n\n## Contributing\n\nContributions are what make open source such a great place to learn and build. Any contributions you make are **greatly appreciated**.\n\n1. Fork the project\n2. Create your feature branch (`git checkout -b feat/amazing-feature`)\n3. Commit your changes (`git commit -m 'feat: add some amazing Features'`)\n4. Push to the branch (`git push origin feat/amazing-feature`)\n5. Open a Pull Request\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n---\n\n## License\n\nDistributed under the **GNU Lesser General Public License v3.0**. See [`LICENSE.LGPL`](LICENSE.LGPL) for more information.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n---\n\n## Contact\n\n**Lennard** — leycm@proton.me\n\nProject Link: [https://github.com/leycm/i18label4j](https://github.com/leycm/i18label4j)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n---\n\n## Acknowledgments\n\n- [Lombok](https://projectlombok.org/) — boilerplate-free Java\n- [SnakeYAML](https://bitbucket.org/snakeyaml/snakeyaml) — YAML parsing\n- [toml4j](https://github.com/moandjiezana/toml4j) — TOML parsing\n- [org.json](https://github.com/stleary/JSON-java) — JSON parsing\n- [Adventure API](https://docs.advntr.net/) — Minecraft text component library\n- [Best-README-Template](https://github.com/othneildrew/Best-README-Template) — README structure inspiration\n- [Choose an Open Source License](https://choosealicense.com)\n- [Shields.io](https://shields.io)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#readme-top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n---\n\n\u003c!-- MARKDOWN LINKS \u0026 BADGES --\u003e\n[contributors-shield]: https://img.shields.io/github/contributors/leycm/i18label4j.svg?style=for-the-badge\n[contributors-url]: https://github.com/leycm/i18label4j/graphs/contributors\n[forks-shield]: https://img.shields.io/github/forks/leycm/i18label4j.svg?style=for-the-badge\n[forks-url]: https://github.com/leycm/i18label4j/network/members\n[stars-shield]: https://img.shields.io/github/stars/leycm/i18label4j.svg?style=for-the-badge\n[stars-url]: https://github.com/leycm/i18label4j/stargazers\n[issues-shield]: https://img.shields.io/github/issues/leycm/i18label4j.svg?style=for-the-badge\n[issues-url]: https://github.com/leycm/i18label4j/issues\n[license-shield]: https://img.shields.io/github/license/leycm/i18label4j.svg?style=for-the-badge\n[license-url]: https://github.com/leycm/i18label4j/blob/master/LICENSE.LGPL\n\n[java-badge]: https://img.shields.io/badge/Java_21-ED8B00?style=for-the-badge\u0026logo=openjdk\u0026logoColor=white\n[java-url]: https://openjdk.org/projects/jdk/21/\n[gradle-badge]: https://img.shields.io/badge/Gradle-02303A?style=for-the-badge\u0026logo=gradle\u0026logoColor=white\n[gradle-url]: https://gradle.org/\n[lombok-badge]: https://img.shields.io/badge/Lombok-BC4521?style=for-the-badge\u0026logo=lombok\u0026logoColor=white\n[lombok-url]: https://projectlombok.org/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleycm%2Fi18label4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleycm%2Fi18label4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleycm%2Fi18label4j/lists"}