
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
@kabeep/node-translate-i18n
Advanced tools
A command-line interface tool for translating localization files to other languages.
Node Translate I18n is a tool for multilingual internationalization, enabling easy translation of localization files into other languages. Translate a Chinese localization file
zh-CN.js, for example, into an English localization fileen-US.js.With a simple command-line interface, you can quickly convert your project's localization files into the desired target language, facilitating cross-language i18n support in NodeJS project.
npm install @kabeep/node-translate-i18n --save
yarn add @kabeep/node-translate-i18n
pnpm add @kabeep/node-translate-i18n
import localize from '@kabeep/node-translate-i18n';
localize({
_: ['./src/locale/en-US.ts'],
to: ['zh-CN', 'ja-JP'],
rewrite: true,
})
.then(console.log)
.catch(console.error);
localize ./en-US.ts -t "zh-CN" "ja-JP" -r
Usage: localize <path> [options]
Options:
-t, --to Target language, specified as ISO 639-1 code [array] [required]
-r, --rewrite Overwrite the file or phrase if it exists
[boolean] [default: false]
-v, --version Show version number [boolean]
-h, --help Show help [boolean]
Examples:
localize ./en-US.ts -t zh-CN -r Overwrite an existing file or phrase
localize ./en-US.js -t zh-CN Use javascript locale files
localize ./en-US.ts -t zh-CN Use typescript locale files
localize ./en-US.json -t zh-CN Use json locale file
For localized files that do not exist, the cli will create and write a new file using the translation from the source file. (The file name comes from the
toparameter).
# locale
# ├── en-US.js (1 row)
# =>
# locale
# ├── en-US.js (1 row)
# + ├── zh-CN.js (1 row)
localize ./locale/en-US.js -t "zh-CN"
When the localization file in the
toparameter already exists, only the new phrases will be written viadiff. This is useful when certain phrases have been manually modified with more accurate translation results.
# locale
# ├── en-US.js (2 row)
# ├── zh-CN.js (1 row)
# ├── ja-JP.js (2 row)
# =>
# locale
# ├── en-US.js (2 row)
# M ├── zh-CN.js (2 row)
# ├── ja-JP.js (2 row)
localize ./locale/en-US.js -t "zh-CN" "ja-JP"
When the localization file in the
toparameter already exists, the existing phrase will be overwritten.
# locale
# ├── en-US.js (2 row)
# ├── zh-CN.js (2 row)
# ├── ja-JP.js (2 row)
# =>
# locale
# ├── en-US.js (2 row)
# M ├── zh-CN.js (2 row)
# M ├── ja-JP.js (2 row)
localize ./locale/en-US.js -t "zh-CN" "ja-JP" -r
to parametersen, zh, ru, ...
en-US, zh-CN, zh-TW, ru-RU, ...
en-US.locale, zh-CN.locale, zh-TW.locale, ru-RU.locale, ...
Unlimited key-value pairs can be viewed format.js docs or polyglot.js docs
Here is an example:
{
"GREETING": "Hello {{name}}"
}
or
export default {
"GREETING": "Hello {{name}}"
}
Contributions via Pull Requests or Issues are welcome.
This project is licensed under the MIT License. See the LICENSE file for details.
FAQs
A command-line interface tool for translating localization files to other languages.
We found that @kabeep/node-translate-i18n demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.