Quickly and 100% free translate your iOS app into multiple languages using Google Translate.
- β 100% free (uses Google Translate)
- β
Works with any iOS app using
.xcstrings - β
Automatic variable preservation (
%@,%d, etc.) - β Rate-limiting protection
- β Automatic backups
- β Resumable on interruption
- β Skip already-translated strings
# 1. Go to your Xcode project directory
cd /path/to/your/XcodeProject
# 2. Copy the script
cp ~/iOS-Translation-Tool/translate_xcstrings.py .
# 3. Create virtual environment
python3 -m venv .venv
# 4. Activate virtual environment
source .venv/bin/activate
# 5. Install library
pip install deep-translator# Test if Google Translate works:
python3 test_translation.py# DRY-RUN (preview without saving):
python3 translate_xcstrings.py --dry-run --target ar
# ACTUAL TRANSLATION:
python3 translate_xcstrings.py --target ar
# With custom filename:
python3 translate_xcstrings.py --file Custom.xcstrings --target ar# Add missing strings for 100% completion:
python3 complete_remaining.py --target arChange the --target parameter:
| Language | Code | Example |
|---|---|---|
| Arabic | ar |
--target ar |
| French | fr |
--target fr |
| Spanish | es |
--target es |
| Italian | it |
--target it |
| Portuguese | pt |
--target pt |
| Russian | ru |
--target ru |
| Chinese (Simplified) | zh-CN |
--target zh-CN |
| Japanese | ja |
--target ja |
| Korean | ko |
--target ko |
| Turkish | tr |
--target tr |
| Dutch | nl |
--target nl |
| Polish | pl |
--target pl |
| Swedish | sv |
--target sv |
Complete list of language codes
If your .xcstrings file uses English keys like this:
{
"strings": {
"Save": { ... },
"Cancel": { ... }
}
}Skip --target en! Xcode automatically uses the key as English fallback.
Only translate to English if your keys are in another language (e.g., German keys need English translation).
See README_ENGLISH_KEYS.md for detailed explanation.
After translation, make the language available in your app:
enum Language: String, CaseIterable {
case system = "system"
case english = "en"
case german = "de"
case arabic = "ar" // NEW
var localizedDisplayName: String {
switch self {
case .system:
let systemLanguage = Locale.preferredLanguages.first?.prefix(2) ?? "en"
return NSLocalizedString("System", comment: "") + " (\(systemLanguage.uppercased()))"
case .english:
return "English"
case .german:
return "Deutsch"
case .arabic:
return "Ψ§ΩΨΉΨ±Ψ¨ΩΨ©" // NEW
}
}
}<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>de</string>
<string>ar</string> <!-- NEW -->
</array>- Settings β Language β Select new language
- App will automatically restart
- UI will mirror for RTL languages (Arabic, Hebrew)
--file PATH Path to .xcstrings file (default: Localizable.xcstrings)
--target LANG Target language (e.g., ar, fr, es)
--source LANG Source language (default: en)
--dry-run Preview without saving# Translate German β French:
python3 translate_xcstrings.py --source de --target fr
# Multiple languages in sequence:
python3 translate_xcstrings.py --target fr
python3 translate_xcstrings.py --target es
python3 translate_xcstrings.py --target itsource .venv/bin/activate
pip install deep-translator# Find your .xcstrings file:
find . -name "*.xcstrings"
# Use --file parameter:
python3 translate_xcstrings.py --file "Path/to/File.xcstrings" --target arScript automatically pauses every 10 strings. For very large projects (>1000 strings):
- Wait 5 minutes between runs
- Or translate in multiple sessions
Wait 1-2 minutes and try again.
| Number of Strings | Duration | Cost |
|---|---|---|
| 100 | ~2 min | $0 |
| 500 | ~8 min | $0 |
| 1000 | ~15 min | $0 |
| 1500 | ~25 min | $0 |
// Emails, URLs, technical values:
Text(verbatim: "user@example.com") // β
Not translatable
// Instead of:
Text("user@example.com") // β Will end up in string catalogScript automatically creates .backup files. Additionally:
# Before translation:
cp Localizable.xcstrings Localizable.xcstrings.before_arabic
# Restore if needed:
cp Localizable.xcstrings.before_arabic Localizable.xcstringsAfter translation:
- Open Xcode β Localizable.xcstrings
- Filter to new language
- Check samples (first 10-20 strings)
- Test app with new language
Add to .gitignore:
# Translation Scripts
*.py
.venv/
translation_*.log
*.xcstrings.backup
- β
translate_xcstrings.py- Main translation script - β
complete_remaining.py- Script for 100% completion - β
test_translation.py- Test script - β
translate_multiple.sh- Batch script for multiple languages - β
LanguageManager_Example.swift- Swift code example - β
requirements.txt- Python dependencies - β
.gitignore- Git ignore template
1. Copy Script β 2. Setup venv β 3. Install lib
β β
4. Test β 5. Translate β 6. Complete 100%
β β
7. Add to App β 8. Test in Xcode β 9. Ready for Store!
- README_ENGLISH_KEYS.md - Important info about English translation
- QUICKSTART.md - Quick start guide (German)
- EXAMPLES.md - Practical examples (German)
MIT License - Free to use for all your iOS projects.
Contributions welcome! Please feel free to submit a Pull Request.
If this tool helps you, please star this repository!
Happy translating! π