Stringify CLI
The Stringify CLI (Command Line Interface) is a specialized tool for managing localization strings by interacting directly with the Stringify platform. It enables developers to download locale files from and upload changes to the Stringify server via the command line. Currently at stable version 1.0.4, it facilitates key localization workflows through commands for initial configuration, project setup, and synchronization of translation files. Its primary differentiator is its tight integration with the Stringify web interface, allowing for streamlined i18n operations using an API token for secure authentication in both development and CI/CD environments. The tool is designed to simplify the process of keeping local translation files in sync with a centralized localization management system.
Common errors
-
stringify: command not found
cause The `stringify-cli` package was not installed globally, or the global npm bin directory is not in your system's PATH.fixRun `npm install -g stringify-cli` to install it globally. If the problem persists, check your system's PATH environment variable. -
Error: API token is not configured. Please run 'stringify config' to set it up.
cause The Stringify API token required for authentication has not been provided or saved.fixExecute `stringify config` and follow the interactive prompts to set up your API token, or set the `STRINGIFY_API_TOKEN` environment variable before running commands. -
No Stringify project found in this directory. Please run 'stringify init'.
cause The current working directory does not contain a `stringify.config.json` file, indicating the project has not been initialized with the CLI.fixNavigate to your project's root directory and run `stringify init` to link it with a project on the Stringify platform and create the configuration file.
Warnings
- gotcha The `stringify pull` command overwrites existing locale files on your local system without confirmation. Any unsynchronized local changes in those files will be lost.
- gotcha During `stringify push`, conflicts can occur if another user has modified the same string after your last pull. The CLI will prompt for interactive conflict resolution, which can block automated workflows.
- gotcha An API token is required for the Stringify CLI to communicate with the server. This can be configured interactively or provided via an environment variable.
- gotcha The CLI is only compatible with Node.js version 10 or higher. Using older versions will lead to installation or runtime errors.
Install
-
npm install stringify-cli -
yarn add stringify-cli -
pnpm add stringify-cli
Quickstart
npm install -g stringify-cli stringify --help # Configure the CLI (will guide through API token acquisition) stringify config # Initialize a project in the current directory, linking to a Stringify project # This creates a stringify.config.json file stringify init # Synchronize locale files (pulls from server, then pushes local changes) # Use process.env.STRINGIFY_API_TOKEN in CI environments STRINGIFY_API_TOKEN="your_api_token" stringify sync