Command-line tool for syncing translations with GetTranslated.ai
Project description
GetTranslated CLI
Command-line tool for syncing translation files with GetTranslated.ai.
Installation
pip install gettranslated-cli
Quick Start
-
Get your API key from your project settings
-
Configure your API using the server key (choose one method):
# Option 1: Environment variable export GETTRANSLATED_KEY="your-api-key-here" # Option 2: Project config file (recommended) echo "your-api-key-here" > .gettranslated # Option 3: Command line (not recommended for production) translate sync -k your-api-key-here
-
Run a sync from your project directory:
cd /path/to/your/project translate sync
That's it! The CLI will:
- Upload your base language files
- Translate any new or untranslated strings
- Download all translated files to your project
Usage
Basic Commands
# Full sync (upload → translate → download)
translate sync
# Upload only
translate upload
# Download only
translate download
# Translate only
translate translate
# Grammar check
translate grammar
Options
# Specify working directory (default: current directory)
translate sync /path/to/project
# Verbose output
translate sync -v
# Force re-upload even if files haven't changed
translate sync -f
# Custom server URL
translate sync -s https://custom-server.com
Supported Platforms
- Android: Automatically finds
strings.xmlfiles invalues/andvalues-XX/directories - iOS: Automatically finds
Localizable.stringsandLocalizable.stringsdictfiles inXX.lproj/directories - React Native: Searches for JSON files in common locations:
locales/src/locales/assets/locales/translations/i18n/- Root directory
API Key Configuration
The CLI looks for your API key in the following order (first match wins):
- Command line argument (
-kor--key) - Environment variable (
GETTRANSLATED_KEY) - Project config file (
.gettranslatedin project directory)
Security Note
⚠️ Important: Add .gettranslated to your .gitignore to avoid committing your API key:
echo ".gettranslated" >> .gitignore
Examples
First-time Setup
# 1. Install the CLI
pip install gettranslated-cli
# 2. Set your API key
export GETTRANSLATED_KEY="your-key-here"
# 3. Navigate to your project
cd ~/projects/my-app
# 4. Run your first sync
translate sync
CI/CD Integration
# GitHub Actions example
name: Sync Translations
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Daily at midnight
jobs:
sync-translations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install GetTranslated CLI
run: pip install gettranslated-cli
- name: Run translation sync
env:
GETTRANSLATED_KEY: ${{ secrets.GETTRANSLATED_KEY }}
run: translate sync .
Troubleshooting
"No API key found" error
Make sure you've configured your API key using one of the methods above. Check that:
- Environment variables are set correctly
- Config files exist and contain the key
- You're running the command from the correct directory
"No [Platform] files found to upload"
Ensure your project structure matches the expected format:
- Android:
app/src/main/res/values/strings.xml - iOS:
XX.lproj/Localizable.strings(traditional format)XX.lproj/Localizable.stringsdict(plurals format)
- React Native: JSON files in one of the common locations
Connection errors
- Verify your internet connection
- Check that the server URL is correct (default:
https://www.gettranslated.ai) - Ensure your API key is valid and has access to the project
Command Reference
translate <mode> [working_directory] [options]
Modes:
upload Upload base language files to server
download Download translated files from server
translate Trigger translation of untranslated strings
sync Run upload → translate → download (recommended)
grammar Run grammar check on project strings
Options:
-k, --key KEY Server API key
-v, --verbose Verbose output mode
-f, --force Force processing even if unchanged
-s, --server URL Server URL (default: https://www.gettranslated.ai)
-h, --help Show help message
License
MIT License
Support
- Documentation: https://www.gettranslated.ai/developers/cli-quickstart/
- Email: support@gettranslated.ai
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gettranslated_cli-1.0.2.tar.gz.
File metadata
- Download URL: gettranslated_cli-1.0.2.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
136f5ae8b387ebde6affed3cee7c4ac68ea9240193b1cff3f62debb1b23222e8
|
|
| MD5 |
9a04f1be228c6735a6b6bfd5a0f6865d
|
|
| BLAKE2b-256 |
d4db8fc585e46a1e1a3fa7e6780d1fbb257a23c5abdc06799a2bb28079f09d0e
|
File details
Details for the file gettranslated_cli-1.0.2-py3-none-any.whl.
File metadata
- Download URL: gettranslated_cli-1.0.2-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9be22ec37d08cacbe6486f1216f4338679ea384a3b7b04cc7e39e9593854cd2
|
|
| MD5 |
0c1b70b8d38eddd792c7a01609a79a2d
|
|
| BLAKE2b-256 |
e6badb9a85a4dfcea95ca12cbf65ac6ec9478db44b96682976bb0d78ada36ad7
|