Introduction
Over time catalog supersedes
.stringsand.stringsdictfilesStrings automatically extraced by Xcode
New keys added to all locales
Supports parameters through String interpolation
You can provide device-specific Strings by right-clicking (e.g. a longer text or differente term on Mac)
Extract
A localizable String has 4 components: key (required), default value (optional, default: key), comment (optional), table (optional, default: “Localizable”)
New single
.xcstringsfile replaces all differenten.lproj/Localizable.stringsfiles with no need for.lprojfoldersXcode searches for localization Strings in: SwiftUI views, Storyboards, .xib files, ObjC code, C code, Shortcut phrases,
Info.plistfilesUse
Text(..., comment: ..., bundle: ...)For localizable views provided in frameworks, use
LocalizedStringResourcetype -> recommended for representing and passing aroundLocalizedStringResourcesupports comment, table, default valueYou can use
String(localized:)orAttributedString(localized:)(to createLocalizedStringResource?)“Use compiler to extract Swift Strings” build setting enabled by default
Extraction woks from:
NSLocalizedString, or any custom names provided to “LocalizedString Macro Names” build settingStrings in Interface Builder are localizable, too (but no way to ignore a specific one, I filed a feedback: FB12264777)
Use
InfoPlist.xcstringsfor Info.plist -> automatic extractionXcode includes big improvements for how Shortcut phrases are localized (dedicated session)
If code provides
defaultValue:updates, the Strings catalog updates –> code is “source of truth”Removed code that has no translations get removed automatically, if translation exists then marked as “Stale”
Xcode does not automatically translate to other languages for you. You can use a drag & drop 3rd-party tool like TranslateKit to do that with ease.
Edit
There’s a way to mark a key as “Manually” managed to silence the “stale” warning
Another red warning for “Untranslated” keys
There’s also a way to mark keys for “Needs Review” or “Reviewed”
Pluralization is built into & simplified with substitutes like
@birdsand@yardswhen multiple params existKeys you add manually (not through extraction) are marked as “Manually” managed by default
Right-click on key and choose “Vary by plural” to turn singular String to a pluralized String
Export
Exporting works like before, creates an
xclocfile which contains all localizables, includig images (standardized format)String Catalogs work for older OS versions as well -> they get converted to
.stringsand.stringsdictfile on build
