Swift CLI utility to translate Xcode String Catalogs (.xcstrings) into a target locale using FoundationModels (Apple Intelligence / on-device model).
- Input:
.xcstrings - Output:
.xcstrings(overwrite by default, or write to--output) - Uses
sourceLanguagefrom the file as the source locale - Translates every key under
strings - Overwrites existing translations for the target locale
- Preserves the original
stringskey order - Skips entries that contain variations (not supported yet)
- Preserves placeholders (
%@,%d,%1$@,\(value),{name}…), retries on mismatch - Logs each key as it translates
- On errors/refusals/placeholder mismatch: keeps source text for target locale and marks it as
needs_review
- macOS 26+
- Apple Silicon
- Apple Intelligence / system model available on the machine
- Xcode 26+ (recommended)
git clone <your-repo-url>
cd xcstrings-ai-translate
swift build -c release.build/release/xcstrings-ai-translatexcstrings-ai-translate <input.xcstrings> <target-locale> [--output <path>].build/release/xcstrings-ai-translate \
/path/to/Localizable.xcstrings \
it