{"id":27290926,"url":"https://github.com/kabeep/node-translate-i18n","last_synced_at":"2025-07-08T07:07:33.975Z","repository":{"id":238930309,"uuid":"797978991","full_name":"kabeep/node-translate-i18n","owner":"kabeep","description":"🌏 A command-line interface tool for translating localization files to other languages.","archived":false,"fork":false,"pushed_at":"2025-01-09T04:15:18.000Z","size":1793,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-27T10:45:20.514Z","etag":null,"topics":["cli","i18n","internationalization","locale","localization","node","translate","translation"],"latest_commit_sha":null,"homepage":"https://github.com/kabeep/node-translate-i18n","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kabeep.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":"2024-05-08T21:16:25.000Z","updated_at":"2025-01-09T04:15:21.000Z","dependencies_parsed_at":"2024-05-10T07:44:50.082Z","dependency_job_id":"89422822-c508-41e3-946e-65fddaa4a696","html_url":"https://github.com/kabeep/node-translate-i18n","commit_stats":null,"previous_names":["kabeep/node-translate-i18n"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/kabeep/node-translate-i18n","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabeep%2Fnode-translate-i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabeep%2Fnode-translate-i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabeep%2Fnode-translate-i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabeep%2Fnode-translate-i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kabeep","download_url":"https://codeload.github.com/kabeep/node-translate-i18n/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabeep%2Fnode-translate-i18n/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264219000,"owners_count":23574869,"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":["cli","i18n","internationalization","locale","localization","node","translate","translation"],"created_at":"2025-04-11T21:39:36.213Z","updated_at":"2025-07-08T07:07:33.952Z","avatar_url":"https://github.com/kabeep.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg width=\"630\" src=\"docs/images/logo.png\" alt=\"logo\"\u003e\n\nA command-line interface tool for translating localization files to other languages.\n\n[![NodeJS](https://img.shields.io/node/v/%40kabeep%2Fnode-translate-i18n?color=lightseagreen)](https://nodejs.org/docs/latest/api/)\n[![License](https://img.shields.io/github/license/kabeep/node-translate-i18n?color=slateblue)](LICENSE)\n[![NPM](https://img.shields.io/npm/d18m/%40kabeep%2Fnode-translate-i18n?color=cornflowerblue)](https://www.npmjs.com/package/@kabeep/node-translate-i18n)\n[![Codecov](https://img.shields.io/codecov/c/github/kabeep/node-translate-i18n?logo=codecov\u0026color=mediumvioletred)](https://codecov.io/gh/kabeep/node-translate-i18n)\n[![Codacy](https://img.shields.io/codacy/grade/dfc924592ec54c55bcd4f5ed940065b9?logo=codacy\u0026logoColor=dodgerblue\u0026color=dodgerblue)](https://app.codacy.com/gh/kabeep/node-translate-i18n/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n[![CircleCI](https://dl.circleci.com/status-badge/img/circleci/Qh23T2Zgw4Fy4V8uvKaymp/SM7PbTQQQRHifxy6jgNcTm/tree/master.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/circleci/Qh23T2Zgw4Fy4V8uvKaymp/SM7PbTQQQRHifxy6jgNcTm/tree/master)\n\nEnglish | [简体中文](README.zh-CN.md)\n\n![Alt](https://repobeats.axiom.co/api/embed/eb1e5895d457cb227266870e7461139852ca040c.svg \"Repobeats analytics image\")\n\n\u003cimg width=\"814\" src=\"docs/images/helper.png\" alt=\"help-information\"\u003e\n\n\u003c/div\u003e\n\n## 📖 Introduction\n\n\u003e Node Translate I18n is a tool for multilingual internationalization, enabling easy translation of localization files\n\u003e into other languages. Translate a Chinese localization file `zh-CN.js`, for example, into an English localization\n\u003e file `en-US.js`.\n\u003e\n\u003e With a simple command-line interface, you can quickly convert your project's localization files into the desired\n\u003e target language, facilitating cross-language i18n support in NodeJS project.\n\n\n\n\u003cimg width=\"814\" src=\"docs/images/usage.gif\" alt=\"usage-gif\"\u003e\n\n## ⚙️ Installation\n\n```bash\nnpm install @kabeep/node-translate-i18n --save\n```\n\n```bash\nyarn add @kabeep/node-translate-i18n\n```\n\n```bash\npnpm add @kabeep/node-translate-i18n\n```\n\n## 🚀 Usage\n\n#### Using in javascript\n\n```javascript\nimport localize from '@kabeep/node-translate-i18n';\n\nlocalize({\n    _: ['./src/locale/en-US.ts'],\n    to: ['zh-CN', 'ja-JP'],\n    rewrite: true,\n})\n    .then(console.log)\n    .catch(console.error);\n```\n\n#### Using in terminal\n\n```shell\nlocalize ./en-US.ts -t \"zh-CN\" \"ja-JP\" -r\n```\n\n```text\nUsage: localize \u003cpath\u003e [options]\n\nOptions:\n  -t, --to       Target language, specified as ISO 639-1 code [array] [required]\n  -r, --rewrite  Overwrite the file or phrase if it exists\n                                                      [boolean] [default: false]\n  -v, --version  Show version number                                   [boolean]\n  -h, --help     Show help                                             [boolean]\n\nExamples:\n  localize ./en-US.ts -t zh-CN -r  Overwrite an existing file or phrase\n  localize ./en-US.js -t zh-CN     Use javascript locale files\n  localize ./en-US.ts -t zh-CN     Use typescript locale files\n  localize ./en-US.json -t zh-CN   Use json locale file\n```\n\n## 🪄 Examples\n\n#### Append\n\n\u003e For localized files that do not exist,\n\u003e the cli will create and write a new file using the translation from the source file.\n\u003e (The file name comes from the `to` parameter).\n\n```shell\n# locale\n#   ├── en-US.js (1 row)\n# =\u003e\n# locale\n#   ├── en-US.js (1 row)\n# + ├── zh-CN.js (1 row)\nlocalize ./locale/en-US.js -t \"zh-CN\"\n```\n\n#### Diff\n\n\u003e When the localization file in the `to` parameter already exists,\n\u003e only the new phrases will be written via `diff`.\n\u003e This is useful when certain phrases have been manually modified\n\u003e with more accurate translation results.\n\n```shell\n# locale\n#   ├── en-US.js (2 row)\n#   ├── zh-CN.js (1 row)\n#   ├── ja-JP.js (2 row)\n# =\u003e\n# locale\n#   ├── en-US.js (2 row)\n# M ├── zh-CN.js (2 row)\n#   ├── ja-JP.js (2 row)\nlocalize ./locale/en-US.js -t \"zh-CN\" \"ja-JP\"\n```\n\n#### Rewrite\n\n\u003e When the localization file in the `to` parameter already exists,\n\u003e the existing phrase will be overwritten.\n\n```shell\n# locale\n#   ├── en-US.js (2 row)\n#   ├── zh-CN.js (2 row)\n#   ├── ja-JP.js (2 row)\n# =\u003e\n# locale\n#   ├── en-US.js (2 row)\n# M ├── zh-CN.js (2 row)\n# M ├── ja-JP.js (2 row)\nlocalize ./locale/en-US.js -t \"zh-CN\" \"ja-JP\" -r\n```\n\n## 🔩 Supported `to` parameters\n\n- [ISO 639-1](https://www.loc.gov/standards/iso639-2/php/code_list.php)\n\n```text\nen, zh, ru, ...\n```\n\n- [RFC 4647](https://www.rfc-editor.org/rfc/rfc4647.txt)\n  （Any combination with [ISO 639-1](https://www.loc.gov/standards/iso639-2/php/code_list.php)，\n  [ISO 15924](https://unicode.org/iso15924/iso15924-codes.html)\n  and [ISO 3166-1](https://www.iso.org/obp/ui/#search)）\n\n```text\nen-US, zh-CN, zh-TW, ru-RU, ...\n```\n\n- Custom file suffix\n\n```text\nen-US.locale, zh-CN.locale, zh-TW.locale, ru-RU.locale, ...\n```\n\n## 📄 Supported file extensions\n\n- Javascript\n- Typescript\n- JSON\n\n## \u003c/\u003e Supported code styles\n\nUnlimited key-value pairs can be viewed\n[format.js docs](https://formatjs.io/docs/core-concepts/basic-internationalization-principles/)\nor [polyglot.js docs](https://airbnb.io/polyglot.js/)\n\nHere is an example:\n\n```json\n{\n    \"GREETING\": \"Hello {{name}}\"\n}\n```\n\nor\n\n```javascript\nexport default {\n    \"GREETING\": \"Hello {{name}}\"\n}\n```\n\n## 🔗 Related\n\n- [i18n-cli](https://github.com/pandodao/i18n-cli) - A CLI tool that utilizes the OpenAI API to translate JSON-based\n  locale files\n- [locize-cli](https://github.com/locize/locize-cli) - locize cli to import / export locales, add / edit / remove, sync\n  segments\n- [node-polyglot](https://github.com/airbnb/polyglot.js) - Give your JavaScript the ability to speak many languages.\n- [node-translate](https://github.com/kabeep/node-translate) - 🦜 A powerful, secure and feature-rich api via Google\n  Translation.\n- [node-translate-cli](https://github.com/kabeep/node-translate-cli) - \u003e A powerful, secure and feature-rich tool via\n  Google Translation in terminal. _\n\n## 🤝 Contribution\n\nContributions via Pull Requests or [Issues](https://github.com/kabeep/node-translate-i18n/issues) are welcome.\n\n## 📄 License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkabeep%2Fnode-translate-i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkabeep%2Fnode-translate-i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkabeep%2Fnode-translate-i18n/lists"}