iOS .strings vs .xcstrings: Auto-Translation Guide
With Xcode 15, Apple introduced String Catalogs (.xcstrings)—replacing legacy Localizable.strings files. However, machine translation tools ruin format specifiers (%@, %d) and break Xcode build compilation. Here is how to automate iOS translation cleanly.
TL;DR — Key Takeaways
- Legacy
.stringsuses key-value syntax ("key" = "value";);.xcstringsuses a multi-locale JSON schema. - Format specifiers like
%@or%lldget mangled into% @by naive translation engines, triggering iOS app crashes. - StrucTrans masks specifiers and respects JSON state tracking in
.xcstringsfiles.
Understanding .strings vs .xcstrings String Catalogs
Apple modernized localization in Xcode 15. Here is how the two formats differ under the hood:
Legacy .strings
Key-Value Text
Separate Localizable.strings files per language directory (en.lproj/, es.lproj/). Easy to corrupt with missing semicolons.
"welcome_title" = "Welcome, %@!";
"item_count" = "You have %d items."; Xcode 15+ .xcstrings
Unified JSON Catalog
Single Localizable.xcstrings JSON file managing all target languages, string variations, device-specific overrides, and translation progress states.
{
"sourceLanguage": "en",
"strings": {
"welcome_title": {
"localizations": {
"es": { "stringUnit": { "value": "¡Bienvenido, %@!" } }
}
}
}
} Raw Translation vs StrucTrans AST-Safe iOS Output
"welcome_title" = "¡Bienvenido, % @!";
"user_age" = "Tiene % d años."; Spaces added inside format specifiers (% @, % d), breaking Swift string interpolation.
"welcome_title" = "¡Bienvenido, %@!";
"user_age" = "Tiene %d años."; Format specifiers %@ and %d locked 100%, syntax fully valid.
Automating iOS Translation for App Store Releases
Follow this tutorial to localize your iOS, iPadOS, or macOS app smoothly.
Export or Select String File
In Xcode 15+, open your project navigator and select Localizable.xcstrings or your legacy Localizable.strings file.
Translate Online via StrucTrans
Upload your file into StrucTrans iOS Strings Translator. Select target languages (Spanish, German, Japanese, Ukrainian).
- Specifiers like
%@,%d,%lld, and%1$@remain tokenized. - JSON schema properties in
.xcstringsstay untouched.
Re-Import into Xcode Project
Replace or merge the translated file into your Xcode project. Xcode automatically registers the newly translated target languages and updates the string catalog completion percentage to 100%.
Frequently Asked Questions
What is the difference between .strings and .xcstrings in iOS?
.strings is Apple's legacy plain text format ('key' = 'value';). Introduced in Xcode 15, .xcstrings (String Catalogs) is a JSON-based format that centralizes all localizations into a single file with state tracking (new, translated, stale).
How does auto-translation protect iOS format specifiers like %@ and %d?
Format specifiers like %@, %d, %lld, and %1$@ are C-style format tokens used by NSString. StrucTrans tokenizes specifiers before translation so machine translation engines cannot add spaces or alter positional indices.
Does auto-translating .xcstrings update string catalog state metadata?
Yes. When translating String Catalogs, StrucTrans preserves the JSON structure, key comments, and updates translation states to 'translated' without corrupting Xcode compilation.
Is StrucTrans free for iOS, macOS, and Swift developers?
Yes. You can upload and translate .strings and .xcstrings files directly in your browser for free.
Translate iOS Localizable Files in Seconds
Upload your .strings or .xcstrings file and preserve format specifiers for seamless App Store submission.