Export & Import
Automate translation export and import workflows for seamless integration with your development process.
Export Translations
Basic Export
langctl export mobile-app -l en -f i18next -o ./locales/en.json
✓ Exported 1,850 keys to ./locales/en.json
langctl export mobile-app -l en,es,fr -f i18next -o ./locales
✓ Exported en -> ./locales/en.json
✓ Exported es -> ./locales/es.json
✓ Exported fr -> ./locales/fr.json langctl export mobile-app -l en -f i18next -o en.json
langctl export mobile-app -l en -f android-xml -o values/strings.xml
langctl export mobile-app -l en -f ios-strings -o en.lproj/Localizable.strings
langctl export mobile-app -l en -f flutter-arb -o app_en.arb
langctl export mobile-app -l en -f flat-json -o en.json
langctl export mobile-app -l en -f nested-json -o en.json langctl export mobile-app -l en --published-only
langctl export mobile-app -l en --include-drafts
langctl export mobile-app -l en --module auth,dashboard
langctl export mobile-app -l en -f json
langctl export mobile-app -l en --pretty langctl export mobile-app --all-languages -f i18next -o ./locales
✓ Exported 5 languages to ./locales/
- en.json (1,850 keys)
- es.json (1,573 keys)
- fr.json (1,443 keys)
- de.json (1,203 keys)
- ja.json (777 keys)
langctl export --all-projects -l en -o ./exports
✓ Exported 3 projects to ./exports/
- mobile-app/
- web-dashboard/
- marketing-site/ langctl import mobile-app -l en -f json ./locales/en.json
Importing translations...
✓ Created: 45 new keys
✓ Updated: 192 existing keys
✓ Skipped: 0 keys
✓ Total: 237 operations
langctl import mobile-app -l es ./translations/es.json --update
langctl import mobile-app -l en ./new-keys.json --skip-existing langctl import mobile-app -l en -f json ./en.json
langctl import mobile-app -l en -f android-xml ./values/strings.xml
langctl import mobile-app -l en -f ios-strings ./en.lproj/Localizable.strings
langctl import mobile-app -l en -f flutter-arb ./app_en.arb
langctl import mobile-app -f csv ./translations.csv langctl import mobile-app -l en ./auth.json --module auth
langctl import mobile-app -l en ./ready.json --publish
langctl import mobile-app -l en ./review.json --draft
langctl import mobile-app -l en ./test.json --dry-run
Preview Results:
Would create: 23 keys
Would update: 8 keys
Would skip: 0 keys langctl import mobile-app -f csv ./all-translations.csv
✓ Imported 3 languages (en, es, fr)
✓ Created/Updated 2 keys per language export-translations.sh
#!/bin/bash
set -e
echo "Exporting translations for production..."
for lang in en es fr de ja; do
echo "Exporting $lang..."
langctl export mobile-app -l $lang -f i18next -o "./src/locales/$lang.json"
done
echo "✓ All translations exported successfully"
git add src/locales/*.json
git commit -m "Update translations [skip ci]"
git push // package.json
{
"scripts": {
"prebuild": "langctl export mobile-app --all-languages -o ./src/locales",
"build": "vite build"
}
} langctl export mobile-app -l en -o ./locales/en.json --watch
Watching for changes...
✓ Exported at 14:32:15 (1,850 keys)
✓ Exported at 14:32:45 (1,851 keys) - 1 key added
✓ Exported at 14:33:15 (1,851 keys) - no changes
langctl export mobile-app -l en -o ./en.json --watch --interval 60 langctl export prod-project -l en -f json > prod-en.json
langctl import staging-project -l en -f json < prod-en.json
✓ Synced 1,850 keys from production to staging
langctl export prod-project -l en --module auth > auth.json
langctl import staging-project -l en < auth.json --module auth langctl diff mobile-app -l en ./locales/en.json
Changes detected:
Added (local -> remote):
+ dashboard.new_feature.title
Modified:
~ home.welcome
Local: "Welcome!"
Remote: "Welcome back!"
Deleted (local -> remote):
- old.unused.key
langctl diff mobile-app -l en ./locales/en.json --apply langctl export mobile-app -l en --transform underscore
langctl export mobile-app -l en --transform strip-module
langctl export mobile-app -l en --transform uppercase langctl export mobile-app -l en --include-metadata -o en.json
{
"_metadata": {
"exported_at": "2024-04-15T10:30:00Z",
"language": "en",
"project": "mobile-app",
"keys_count": 1850,
"cli_version": "1.0.0"
},
"home": {
"welcome": "Welcome!"
}
} langctl export mobile-app -l en -o en.json --if-changed
No changes detected since last export
✓ Skipped export
langctl export mobile-app -l es --complete-only
⚠ Warning: Skipping 277 incomplete keys
✓ Exported 1,573 complete keys langctl import mobile-app -l en ./import.json --validate
Validation Results:
✓ JSON syntax valid
✓ All keys valid format
✓ No duplicate keys
✓ 237 keys ready for import
langctl import mobile-app -l en ./import.json --fix
Fixed 3 issues:
- Converted key_name to key.name
- Removed invalid character from profile_bio
- Fixed parameter syntax: {user} -> {{user}} Empty export file:
langctl keys list mobile-app --published
langctl export mobile-app -l en --include-drafts Parameters not converting:
langctl export mobile-app -l en -f android-xml --convert-params
langctl keys get mobile-app home.welcome Import validation failed:
langctl import mobile-app -l en ./file.json --verbose
langctl import mobile-app -l en ./file.json --fix Encoding problems:
file -I translations.json
iconv -f ISO-8859-1 -t UTF-8 input.json > output.json
langctl import mobile-app -l en output.json Next Steps
- CI/CD Integration - Automate in pipelines
- Platform Integrations - Platform-specific guides
- Export Formats - Format specifications
- Dashboard Export - Web interface guide