-
Create Scripts directory in your project:
mkdir Scripts cd Scripts -
Copy these files:
update-translations.pyexport-translations.pyupdate-all-languages.shREADME-GITHUB.md(rename to README.md)LICENSE
-
Make executable:
chmod +x update-all-languages.sh chmod +x update-translations.py chmod +x export-translations.py
-
Test it:
python3 update-translations.py --help
git submodule add https://github.com/username/xcstrings-tools Scripts/xcstrings-toolsThe scripts auto-detect your Localizable.xcstrings file in these locations:
<ProjectName>/Resources/Localizable.xcstringsResources/Localizable.xcstringsLocalizable.xcstrings
To customize, edit the search paths in both Python scripts:
search_paths = [
Path.cwd() / "YourApp" / "Resources" / "Localizable.xcstrings",
Path.cwd() / "Resources" / "Localizable.xcstrings",
# Add your custom paths here
]Edit update-all-languages.sh to match your language files:
get_lang_code() {
case "$1" in
"German.csv") echo "de" ;;
"Spanish.csv") echo "es-419" ;;
# Add your CSV filenames and language codes
*) echo "" ;;
esac
}Recommended setup:
YourProject/
├── YourApp/
│ └── Resources/
│ └── Localizable.xcstrings
├── Scripts/
│ ├── update-translations.py
│ ├── export-translations.py
│ ├── update-all-languages.sh
│ ├── README.md
│ └── LICENSE
└── Translations/ (optional - for CSV files)
├── German.csv
├── Spanish.csv
└── French.csv
Run these commands to verify everything works:
# Test update script
python3 Scripts/update-translations.py --help
# Test export script
python3 Scripts/export-translations.py --help
# Test batch script
./Scripts/update-all-languages.sh --help- Python 3.6+ (comes with macOS)
- Xcode 15+ (for String Catalogs)
- No external packages - uses Python standard library only
macOS includes Python 3. If missing, install via:
xcode-select --installMake scripts executable:
chmod +x Scripts/*.sh Scripts/*.pySpecify path explicitly:
python3 update-translations.py -l de -c German.csv -x "Path/To/Localizable.xcstrings"- Export your first translation:
python3 export-translations.py -l de -o German.csv - Read the main README for usage examples
- Set up your batch script with your languages
- Integrate into your workflow!