xcTranslate is a command-line tool written in Go for translating Apple's .xcstrings localization files using Google Translate.
It reads a source .xcstrings file (in JSON format), detects all untranslated base strings, translates them into multiple target languages, and generates a new .xcstrings file with completed localizations.
- Reads and writes valid
.xcstrings(Apple localization JSON format) - Automatic source language detection
- Supports translation into multiple languages
- Preserves placeholders such as
%1$@,%lld,{name}, etc. - Simple CLI usage
- Thread-safe translation engine using mutex protection
go install github.com/yourusername/xctranslate@latestxctranslate -input=Localizable.xcstrings -output=Translated.xcstrings -langs=it,fr,de| Flag | Description |
|---|---|
-input |
Path to the input .xcstrings file |
-output |
Path to save the translated .xcstrings |
-langs |
Comma-separated list of target languages (e.g. it,fr,de) |
The translated file will preserve the original structure and include localizations in the form:
"Hello, world!" : {
"localizations" : {
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ciao, mondo!"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Bonjour le monde!"
}
}
}
}- Uses the unofficial
gtranslatepackage, which scrapes the Google Translate web interface - Not recommended for high-volume or production use
- Translations are processed sequentially (no concurrent translation engine)
MIT License — see LICENSE
- bregydoc/gtranslate
- Inspired by real-world localization challenges in Apple app development