← 全部工具

locize-cli

热度 65 更新于 开发与构建

locize cli to import locales

npmauto-collected

安装

npm
npm install -g locize-cli

通过 npm 安装。

Getting started with the locize-cli

Step 0: Install the cli

with npm (preferred globally)

npm install -g locize-cli

ℹ️ Since v12.5.1 the SheetJS xlsx library is bundled into the package (Apache-2.0, license included), so installing works with every package manager. Older releases pinned xlsx to the official SheetJS CDN tarball (the npm registry version is outdated and has known vulnerabilities), which pnpm 11 (ERRPNPMEXOTICSUBDEP) and npm 12 (EALLOWREMOTE) block by default — for locize-cli <= 12.5.0 on pnpm, set blockExoticSubdeps: false in your pnpm-workspace.yaml.

with Shell: (downloads released (linux or macos) binaries)

curl -fsSL https://raw.githubusercontent.com/locize/locize-cli/master/install.sh | sh

with PowerShell: (downloads released (windows) binaries)

iwr https://raw.githubusercontent.com/locize/locize-cli/master/install.ps1 -useb | iex

⚠️ Filename restrictions The namespace you choose becomes your on-disk filename, so please avoid these characters: < (less than) (greater than) : (colon) " (double quote) / (forward slash) \ (backslash) | (vertical bar or pipe) ? (question mark) (asterisk) These are sometimes illegal on various operating systems, so using them may lead to files not being written or being written incorrectly. If necessary, use only letters, numbers, hyphens ("-") and underscores ("") in your namespace names.

Adding/Updating new keys

Step 1: execute

Add your api-key and your project-id and let's go...

locize add --api-key my-api-key-d9de-4f55-9855-a9ef0ed44672 --project-id my-project-id-93e1-442a-ab35-24331fa294ba --language en namespace1 myNewKey "My new value"

Remove keys

Step 1: execute

Add your api-key and your project-id and let's go...

locize remove --api-key my-api-key-d9de-4f55-9855-a9ef0ed44672 --project-id my-project-id-93e1-442a-ab35-24331fa294ba --language en namespace1 myNewKey