StrongLoop Globalize CLI
raw JSON →strong-globalize-cli is a command-line interface tool designed to facilitate the globalization of JavaScript applications. Its primary functions include extracting translatable text messages from JavaScript and HTML source code, linting message files to identify potential issues, and integrating with IBM Globalization Pipeline for automated machine translation. The current stable version is 7.1.1, supporting Node.js versions 10.x and above. The tool distinguishes itself with both 'regular extraction' for package development and 'deep extraction' for enterprise-scale applications, allowing comprehensive identification of all literal strings—globalized or not—within a codebase. Its release cadence is tied to updates in globalization features or the underlying IBM Cloud services it integrates with.
Common errors
error slt-globalize: command not found ↓
npm install -g strong-globalize-cli. error Error: IBM Cloud credentials are not provided or invalid when running `slt-globalize -t`. ↓
BLUEMIX_URL, BLUEMIX_USER, BLUEMIX_PASSWORD, and BLUEMIX_INSTANCE environment variables are set, or that ~/.strong-globalize/ibm-cloud-credentials.json exists and contains valid credentials. error Error: Failed to parse messages.json: Unexpected token ... ↓
messages.json file, or re-run slt-globalize -e to regenerate it if no manual changes were intended. Warnings
gotcha The `slt-globalize` command requires Node.js version 10.x or higher. Earlier Node.js versions are not supported and may lead to unexpected behavior or errors. ↓
gotcha To utilize the translation feature (`slt-globalize -t`), access credentials for IBM Globalization Pipeline on IBM Cloud must be provided. This can be done either through environment variables (BLUEMIX_URL, BLUEMIX_USER, BLUEMIX_PASSWORD, BLUEMIX_INSTANCE) or by placing a `ibm-cloud-credentials.json` file in your home directory's `.strong-globalize` folder. ↓
gotcha The `extract` mode (`-e`) and `deepextract` mode (`-d`) serve different purposes. Regular extraction (`-e`) is typically for package development, while deep extraction (`-d`) is designed for enterprise-scale applications and includes non-globalized literal strings in `intl/zz/messages.json` to help identify untranslated content. ↓
Install
npm install strong-globalize-cli yarn add strong-globalize-cli pnpm add strong-globalize-cli Quickstart
npm install -g strong-globalize-cli
# Create a sample JavaScript file
echo "const g = require('strong-globalize'); g.log('Hello, World!');" > app.js
# Extract strings (creates intl/en/messages.json and intl/zz/messages.json)
slt-globalize -e
# Lint the extracted messages file
slt-globalize -l
# Configure IBM Globalization Pipeline credentials via environment variables
export BLUEMIX_URL="${process.env.BLUEMIX_URL ?? 'https://gp-beta-rest.ng.bluemix.net/translate/rest'}"
export BLUEMIX_USER="${process.env.BLUEMIX_USER ?? 'your-user-id'}"
export BLUEMIX_PASSWORD="${process.env.BLUEMIX_PASSWORD ?? 'your-password'}"
export BLUEMIX_INSTANCE="${process.env.BLUEMIX_INSTANCE ?? 'your-instance-id'}"
# Translate strings using Globalization Pipeline (requires credentials setup)
slt-globalize -t