owowagency / wordsmith-cli
此包最新版本(1.11.0)没有提供许可证信息。
1.11.0
2023-11-10 10:49 UTC
Requires (Dev)
- guzzlehttp/guzzle: ^7.8
This package is auto-updated.
Last update: 2024-09-10 12:41:21 UTC
README
用法
NPM
您可以使用 npx 或通过您的首选包管理器安装它来使用 CLI
npx @owowagency/wordsmith-cli --help # npm npm install -g @owowagency/wordsmith-cli # yarn yarn global add @owowagency/wordsmith-cli # pnpm pnpm install -g @owowagency/wordsmith-cli wordsmith --help
您也可以按项目安装它并用作脚本
# npm npm install @owowagency/wordsmith-cli # yarn yarn add @owowagency/wordsmith-cli # pnpm pnpm install @owowagency/wordsmith-cli
然后,将以下内容添加到您的 package.json
{
"scripts": {
"wordsmith": "wordsmith"
}
}
Composer
要使用 Composer 使用 CLI,请使用以下命令安装:
composer require owowagency/wordsmith-cli
然后,将以下内容添加到您的 composer.json
{
"scripts": {
"wordsmith": "wordsmith"
}
}
composer wordsmith -- --help
Github actions
要在 Github actions 中使用 CLI,请使用 wordsmith-action
命令
列出项目
列出访问令牌范围内的所有项目,可以在 wordsmith.yml 中配置,参见 配置
wordsmith list-projects --env=wordsmith.yml
拉取
从 API 拉取翻译文件,翻译文件可以在 wordsmith.yml 中配置,参见 配置
wordsmith pull --env=wordsmith.yml
推送
将翻译文件推送到 API,翻译文件可以在 wordsmith.yml 中配置,参见 配置
wordsmith push --env=wordsmith.yml --force --verify
配置
Wordsmith CLI 接受 YAML 配置文件,默认配置文件是 wordsmith.yml,但可以在推送和拉取命令中使用 --env 标志进行覆盖
顶级
目标
剩余的任何属性都将传递给 API 进行推送或拉取。
支持的格式
apple-strings(iOS)android-strings(Android xml)jsoncsvi18next(i18next)po(Gettext)apple-xliffangular-xliffsymfony-xliff
示例配置
project-id: 1 # Use "${{ ENV_VARIABLE_NAME }}" to use environment variables (recommended) # Access tokens can also be stored in the config file directly (not recommended) # Defaults: ${{ WORDSMITH_ACCESS_TOKEN }} token: ${{ WORDSMITH_ACCESS_TOKEN }} targets: # The file to use when pulling/pushing, {locale} will be replaced by the pulled/pushed locale, e.g. locales/values-en/strings-web.xml - file: locales/values-{locale}/strings-app.xml # [Optional] The file to use when pulling/pushing the default locale default-locale-override: locales/values/strings-app.xml # Types of this target, possible values: push, pull types: - push - pull # Format of the file, possible values: # - apple-strings (iOS Localizable string files) # - android-strings (XML Android string files) # - csv # - i18next # - json file-type: android-strings # [Optional] tags to include when pulling/pushing this file tags: - app - file: locales/values-{locale}/strings-library.xml default-locale-override: locales/values/strings-library.xml types: - push - pull file-type: android-strings tags: - library