{"id":28531196,"url":"https://github.com/pinterest/l10nmessages","last_synced_at":"2025-07-07T12:31:30.909Z","repository":{"id":101525383,"uuid":"508477940","full_name":"pinterest/l10nmessages","owner":"pinterest","description":"L10nMessages is a library that makes internationalization (i18n) and localization (l10n) of Java applications easy and safe.","archived":false,"fork":false,"pushed_at":"2024-03-28T07:08:34.000Z","size":3132,"stargazers_count":18,"open_issues_count":5,"forks_count":6,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-06-09T15:11:35.788Z","etag":null,"topics":["annotation-processor","bazel","fluent-api","format","gradle","i18n","icu4j","internationalization","java","l10n","localization","maven"],"latest_commit_sha":null,"homepage":"https://l10nmessages.io","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/pinterest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-06-28T22:55:57.000Z","updated_at":"2025-06-03T16:36:23.000Z","dependencies_parsed_at":"2023-11-14T02:25:49.341Z","dependency_job_id":"d4b1b20c-a878-47db-a09a-6631af39a7ac","html_url":"https://github.com/pinterest/l10nmessages","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/pinterest/l10nmessages","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinterest%2Fl10nmessages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinterest%2Fl10nmessages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinterest%2Fl10nmessages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinterest%2Fl10nmessages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pinterest","download_url":"https://codeload.github.com/pinterest/l10nmessages/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinterest%2Fl10nmessages/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264077296,"owners_count":23553826,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["annotation-processor","bazel","fluent-api","format","gradle","i18n","icu4j","internationalization","java","l10n","localization","maven"],"created_at":"2025-06-09T15:09:54.839Z","updated_at":"2025-07-07T12:31:30.897Z","avatar_url":"https://github.com/pinterest.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# L10nMessages\n\n[![Build](https://github.com/pinterest/l10nmessages/actions/workflows/build.yml/badge.svg)](https://github.com/pinterest/l10nmessages/actions/workflows/build.yml)\n[![License](http://img.shields.io/:license-Apache%202-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.txt)\n[![Maven Central](https://img.shields.io/maven-central/v/com.pinterest.l10nmessages/l10nmessages.svg?label=maven%20central)](https://search.maven.org/search?q=g:%22com.pinterest.l10nmessages%22%20AND%20a:%22l10nmessages%22)\n[![javadoc](https://javadoc.io/badge2/com.pinterest.l10nmessages/l10nmessages/javadoc.svg)](https://javadoc.io/doc/com.pinterest.l10nmessages/l10nmessages)\n[![Installation](https://img.shields.io/badge/installation-1.0.5-aaffee)](https://l10nmessages.io/docs/installation)\n\n`L10nMessages` is a library that makes internationalization (i18n) and localization (l10n) of Java\napplications easy and safe.\n\nIt provides a [fluent API](https://l10nmessages.io/docs/fluent-api) to load and \nformat messages that is built on top of Java standard libraries. In addition to simplifying the \noverall setup, it brings strong typing and compile time checks to the mix when used with the \n[annotation processor](https://l10nmessages.io/docs/annotation-processor).\n\n## Full Documentation\n\nThe full documentation is [here](https://l10nmessages.io/).\n\n## Installation\n\nSee [general instructions](https://l10nmessages.io/docs/installation) and \nguides for [Bazel](https://l10nmessages.io/docs/installation/bazel),\n[Gradle](https://l10nmessages.io/docs/installation/gradle) and\n[Maven](https://l10nmessages.io/docs/installation/maven).\n\n## Getting Started\n\nAlso available in the\n[full documentation](https://l10nmessages.io/docs/getting-started/) (with file\npaths).\n\n### Create a resource bundle\n\nCreate a root file: `Messages.properties` in the `com.pinterest.l10nmessages.example` package.\n\nThe corresponding resource bundle `baseName` is `com.pinterest.l10nmessages.example.Messages`.\n\n`UTF-8` is the recommended encoding for the `properties` files.\n\nIn a project that follows the Maven layout, the file would be:\n\n```properties title=\"src/resources/java/com/pinterest/l10nmessages/example/Messages.properties\"\nwelcome_user=Welcome {username}!\n```\n\n### Register the resource bundle with `@L10nProperties`\n\nAdd the `@L10nProperties` annotation to the application class to register the resource bundle with\nthe annotation processor.\n\n```java title=\"src/main/java/com/pinterest/l10nmessages/example/Application.java\"\nimport com.pinterest.l10nmessages.L10nProperties;\n\n@L10nProperties(baseName = \"com.pinterest.l10nmessages.example.Messages\")\npublic class Application {\n\n}\n```\n\n## Enum generated by the annotation processor\n\nCompile your project. The annotation processor should generate the following `enum`:\n\n```java title=\"target/generated-sources/annotations/com/pinterest/l10nmessages/example/Messages.java\"\npackage com.pinterest.l10nmessages.example;\n\npublic enum Messages {\n  welcome_user(\"welcome_user\");\n\n  public static final String BASENAME = \"com.pinterest.l10nmessages.example.Messages\";\n  // ...\n}\n```\n\n### Strong typing using Enum\n\nThat `enum` can be used to create the `L10nMessages` instance and then to format a message using the\ntyped key: `Messages.welcome_user`. The argument: `username` is provided as a key/value pair.\n\n```java title=\"src/main/java/com/pinterest/l10nmessages/example/Application.java\"\nimport com.pinterest.l10nmessages.L10nMessages;\nimport com.pinterest.l10nmessages.L10nProperties;\n\n@L10nProperties(baseName = \"com.pinterest.l10nmessages.example.Messages\")\npublic class Application {\n\n  public static void main(String[] args) {\n    L10nMessages\u003cMessages\u003e m = L10nMessages.builder(Messages.class).build();\n    String localizedMsg = m.format(Messages.welcome_user, \"username\", \"Mary\");\n    System.out.println(localizedMsg);\n    // Welcome Mary!\n  }\n}\n```\n\nFor extra typing, consider [argument names typing](https://l10nmessages.io/docs/fluent-api#argument-names-typing).\n\n### Localization\n\nLocalize the root properties file by creating the file `Messages_fr.properties` for \"French\"\n\n```properties\nwelcome_user=Bienvenue {username}!\n```\n\nSpecify the locale wanted for the messages\n\n```java\n\n@L10nProperties(baseName = \"com.pinterest.l10nmessages.example.Messages\")\npublic class Application {\n\n  public static void main(String[] args) {\n    L10nMessages\u003cMessages\u003e m = L10nMessages.builder(Messages.class)\n        .locale(Locale.FRENCH)\n        .build();\n    String localizedMsg = m.format(Messages.welcome_user, \"username\", \"Mary\");\n    System.out.prinln(localizedMsg);\n    // Bienvenue Mary!\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpinterest%2Fl10nmessages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpinterest%2Fl10nmessages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpinterest%2Fl10nmessages/lists"}