{"id":21320860,"url":"https://github.com/aurambaj/mojito-rb-gen","last_synced_at":"2026-05-15T22:03:41.055Z","repository":{"id":36253565,"uuid":"40557974","full_name":"aurambaj/mojito-rb-gen","owner":"aurambaj","description":"Localization utility that converts `.properties` files into `JSON`/`JS` resource bundles.","archived":false,"fork":false,"pushed_at":"2015-08-11T18:27:05.000Z","size":124,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-25T15:47:49.351Z","etag":null,"topics":["i18n","javascript","json","localization","properties","translation","translation-management"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aurambaj.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}},"created_at":"2015-08-11T18:21:09.000Z","updated_at":"2022-06-30T18:22:54.000Z","dependencies_parsed_at":"2022-08-17T22:31:09.566Z","dependency_job_id":null,"html_url":"https://github.com/aurambaj/mojito-rb-gen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aurambaj%2Fmojito-rb-gen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aurambaj%2Fmojito-rb-gen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aurambaj%2Fmojito-rb-gen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aurambaj%2Fmojito-rb-gen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aurambaj","download_url":"https://codeload.github.com/aurambaj/mojito-rb-gen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243801611,"owners_count":20350106,"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":["i18n","javascript","json","localization","properties","translation","translation-management"],"created_at":"2024-11-21T19:54:58.132Z","updated_at":"2025-10-13T06:32:41.406Z","avatar_url":"https://github.com/aurambaj.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mojito-rb-gen\n\nLocalization utility that converts `.properties` files into `JSON`/`JS` resource bundles.\n\n# Install\n\n`npm install -g mojito-rb-gen`\n\n# Usage\n\nEach `.properties` files in the source directory will be converted into a `JSON` or `JS` resource bundle.\n\nOne of the `.properties` file is the source resource bundle (by default `en.properties`, use `--source-bundle` to \noverride) and contains the source strings that are usually modified during development. Other files contain\nthe localized strings.  \n\nThe `JSON`/`JS` localized resource bundles are generated by merging the source strings with the translated strings from \nthe `.properties` files. This ensure that the localized resource bundles contain all the strings required by the application\n even if the translations are not yet available.\n\n```\nUsage:\n  mojito-rb-gen [OPTIONS] [ARGS]\n\nOptions:\n  -s, --source-directory [PATH] Source directory (Default is .)\n  -o, --output-directory [PATH] Output directory (Default is .)\n  -b, --source-boundle   [STRING] Source bundle file (Default is en.properties)\n  -n, --use-namespaces   BOOLEAN Use namespaces when parsing properties files\n  -t, --output-type      [STRING] Output type: json, js (Default is json)\n  -w, --watch BOOLEAN    Watch the source directory for changes and rebuild\n                         resource bundles\n      --js-variable      [STRING] Varaible name used to generate Javascript file  (Default is MESSAGES)\n  -k, --no-color         Omit color from output\n      --debug            Show debug information\n  -h, --help             Display help and usage details\n```\n\n# Merge logic\n\nWith source bundle: `en.properties`\n\n```properties\n# Group 1 Key 1 Comment\ngroup1.key1 = Group 1 Key 1\ngroup1.key2 = Group 1 Key 2\ngroup2.key1 = Group 1 Key 1\n```\n\nand localized properties: `fr.properties`\n \n```properties\ngroup1.key2 = Group 1 Key 2 (fr)\noutdated = Outdated\n```\n \nThe merge output in `JSON` will be:\n\n```json\n{\"group1.key1\":\"Group 1 Key 1\",\"group1.key2\":\"Group 1 Key 2 (fr)\",\"group2.key1\":\"Group 2 Key 1\",\"outdated\":\"Outdated\"}\n```\n\n# Examples\n\n## Output types\n\n### JSON\n\n``` sh \n$ mojito-rb-gen -s examples/src/ -o examples/out/json/\n```\n\n``` json\n{\"group1.key1\":\"Group 1 Key 1\",\"group1.key2\":\"Group 1 Key 2 (fr)\",\"group2.key1\":\"Group 2 Key 1\",\"outdated\":\"Outdated\"}\n```\n\n### Javascript\n\n```sh \n$ mojito-rb-gen -s examples/src/ -o examples/out/js/default -t js\n```\n\n```js\nMESSAGES = {\"group1.key1\":\"Group 1 Key 1\",\"group1.key2\":\"Group 1 Key 2 (fr)\",\"group2.key1\":\"Group 2 Key 1\",\"outdated\":\"Outdated\"};\n```\n\n### Configure Javascript variable name \n\n```sh \n$ mojito-rb-gen -s examples/src/ -o examples/out/js/var/ -t js --js-variable MY_MESSAGES\n```\n\n```js\nMY_MESSAGES = {\"group1.key1\":\"Group 1 Key 1\",\"group1.key2\":\"Group 1 Key 2 (fr)\",\"group2.key1\":\"Group 2 Key 1\",\"outdated\":\"Outdated\"};\n```\n\n### Use namespaces\n\n```sh \n$ mojito-rb-gen -s examples/src/ -o examples/out/js/namespaces/ -t js --js-variable MY_MESSAGES_NS -n\n```\n\n```js\nMY_MESSAGES_NS = {\"group1\":{\"key1\":\"Group 1 Key 1\",\"key2\":\"Group 1 Key 2 (fr)\"},\"group2\":{\"key1\":\"Group 2 Key 1\"},\"outdated\":\"Outdated\"};\n```\n\n## Watch source directory for changes and rebuild resources bundles\n\n```sh \n$ mojito-rb-gen -s examples/src/ -o out -w\nINFO: Start watching: examples/src/\nINFO: en.properties changed, generate resource bundles\n```\n\n### Use a different source bundle\n\n```sh \n$ mojito-rb-gen -s examples/src/ -o out -b en-US.properties\n```\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faurambaj%2Fmojito-rb-gen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faurambaj%2Fmojito-rb-gen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faurambaj%2Fmojito-rb-gen/lists"}