owowagency/wordsmith-cli 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

owowagency/wordsmith-cli

Composer 安装命令:

composer require owowagency/wordsmith-cli

包简介

README 文档

README

  1. Usage
    1. NPM
    2. Composer
    3. Github actions
  2. Commands
    1. List projects
    2. Pull
    3. Push
  3. Configuration
    1. Top level
    2. Targets
    3. Supported formats
  4. Example configuration

Usage

NPM

You can use the CLI using npx or by installing it with your preferred package manager:

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

You can also install it per project and use it as a script:

# npm
npm install @owowagency/wordsmith-cli
# yarn
yarn add @owowagency/wordsmith-cli
# pnpm
pnpm install @owowagency/wordsmith-cli

Then add the following to your package.json:

{
    "scripts": {
        "wordsmith": "wordsmith"
    }
}

Composer

To use the CLI using composer, install it using:

composer require owowagency/wordsmith-cli

Then add the following to your composer.json:

{
    "scripts": {
        "wordsmith": "wordsmith"
    }
}
composer wordsmith -- --help

Github actions

To use the CLI in Github actions, use the wordsmith-action

Commands

List Projects

Lists all projects in the scope of the access token, which can be configured in wordsmith.yml, see Configuration

wordsmith list-projects --env=wordsmith.yml
short long type default description
-e --env String wordsmith.yml Path to the configuration file
--access-token String wordsmith.yml Access token
--verbose Bool false Enables verbose logging

Pull

Pulls translation files from the API, translation files can be configured in wordsmith.yml, see Configuration

wordsmith pull --env=wordsmith.yml
short long type default description
-e --env String wordsmith.yml Path to the configuration file
--access-token String wordsmith.yml Access token
--verbose Bool false Enables verbose logging

Push

Pushes translation files to the API, translation files can be configured in wordsmith.yml, see Configuration

wordsmith push --env=wordsmith.yml --force --verify
short long type default description
-e --env String wordsmith.yml Path to the configuration file
--access-token String wordsmith.yml Access token
-f --force Bool false Overwrite existing translations
-v --verify Bool false Verify pushed translations
--verbose Bool false Enables verbose logging

Configuration

Wordsmith CLI accepts YAML configuration files, the default configuration file is wordsmith.yml but can be overwritten using the --env flag on push and pull commands

Top level

name type description
project-id Number ID of the project
token String Access token or environment variable for access token, default: ${{ WORDMSMITH_ACCESS_TOKEN }}
targets Target[] See Targets

Targets

Any remaining properties will be passed on to the API when pushing or pulling.

name type description
file String Path to the translation file, {locale} will be replaced with the locale e.g. values-{locale}/strings.xml will become values-en/strings.xml
default-locale-override String? Path override for the default locale, this may be useful on Android where the default strings are stored in values/ instead of values-{locale}/
locales String[] Locales to pull/push, defaults to existing project locales
types (pull | push)[] Enables push and/or pull for this target
file-type String The file format of the translation file, see Supported formats
tags String[] Pull only translations with given tags or attach tags to pushed translations, defaults to []

Supported formats

  • apple-strings (iOS)
  • android-strings (Android xml)
  • json
  • csv
  • i18next (i18next)
  • po (Gettext)
  • apple-xliff
  • angular-xliff
  • symfony-xliff

Example Configuration

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

owowagency/wordsmith-cli 适用场景与选型建议

owowagency/wordsmith-cli 是一款 基于 Rust 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 10 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 owowagency/wordsmith-cli 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 owowagency/wordsmith-cli 我们能提供哪些服务?
定制开发 / 二次开发

基于 owowagency/wordsmith-cli 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: Rust

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-10-25