owowagency / wordsmith-cli
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
Language:Rust
Requires (Dev)
- guzzlehttp/guzzle: ^7.8
This package is auto-updated.
Last update: 2024-11-10 13:00:33 UTC
README
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
Pull
Pulls translation files from the API, translation files can be configured in wordsmith.yml
, see Configuration
wordsmith pull --env=wordsmith.yml
Push
Pushes translation files to the API, translation files can be configured in wordsmith.yml
, see Configuration
wordsmith push --env=wordsmith.yml --force --verify
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
Targets
Any remaining properties will be passed on to the API when pushing or pulling.
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