
Apple has always emphasized building apps that feel native to users worldwide. One powerful tool that simplifies this process is Localizable.xcstrings, introduced by Apple as a modern replacement for the older .strings files. This guide explains what Localizable.xcstrings is, its purpose, architecture, workflow, and how you can get started.
๐ What is Localizable.xcstrings?
Localizable.xcstrings is a structured localization file format introduced by Apple in Xcode 12 and iOS 14+. It replaces traditional .strings files with a key-value JSON format, enhancing localization support with metadata, context, pluralization, and variant handling.
This format works with Xcodeโs String Catalog, providing a more intuitive and scalable way to manage localized content across languages and regions.
Key Benefits Over .strings:
- Supports contextual information for translators
- Handles pluralization and formatting natively
- Fully integrated into Xcodeโs localization workflow
- Reduces errors and ambiguities in translation
๐ก Major Use Cases of Localizable.xcstrings
1. App Localization
Translate app UI text, labels, alerts, tooltips, and other interface strings into multiple languages seamlessly.
2. Dynamic Content Presentation
Localize plural forms (e.g., 1 item vs. 2 items) using Appleโs ICU-based syntax.
3. Enhanced Translator Experience
Provide context and notes for translators directly within the localization file.
4. Team Collaboration
Facilitates better coordination between developers, designers, and translators by reducing ambiguity in translations.
5. Automated Export/Import
Streamline translation workflows using Xcode or third-party tools to export .xcstrings to common translation platforms.
๐ How Localizable.xcstrings Works (with Architecture)
๐ฆ Architecture Overview:
- Xcode Source Code & UI Strings
- Developers annotate localizable strings using
NSLocalizedStringor SwiftString(localized:).
- Developers annotate localizable strings using
- Localization Extraction
- Xcode extracts these strings into a centralized
.xcstringsfile using a structured JSON format.
- Xcode extracts these strings into a centralized
- String Catalog (Strings Dict)
- The
.xcstringsfile stores translation keys with:- Base string
- Context (optional)
- Variants (plural, gender, etc.)
- Comments for translators
- The
- Runtime Resolution
- At runtime, iOS selects the appropriate localized string based on the deviceโs language settings.
- App Delivery
- Compiled
.xcstringsbecome part of the app bundle, loaded dynamically at runtime.
- Compiled
๐งฌ Sample Structure of Localizable.xcstrings
{
"example.string": {
"localizations": {
"en": {
"stringUnit": {
"value": "Hello, World!",
"comment": "Greeting shown on the main screen"
}
},
"es": {
"stringUnit": {
"value": "ยกHola, Mundo!",
"comment": "Saludo que se muestra en la pantalla principal"
}
}
}
}
}
๐ Basic Workflow of Localizable.xcstrings
Step-by-Step Workflow:
- Define Strings in Code Use
NSLocalizedStringor Swiftโs nativeString(localized:). - Create
.xcstringsvia String Catalog In Xcode, go to File โ New โ File โ String Catalog โ Name itLocalizable. - Add Locales In the File Inspector, click โLocalizeโฆโ and add required languages (e.g., French, German).
- Edit Translations Input translations in the table-like UI or JSON structure. Add notes for translators if needed.
- Export/Import for Translation Export
.xlifffor translation and re-import once translations are complete. - Build & Test Build the app and run in different locales using Xcode scheme settings or simulator.
๐ Step-by-Step Getting Started Guide
๐ ๏ธ Step 1: Create a String Catalog
- Open Xcode โ File โ New โ File โ String Catalog
- Name it
Localizable.xcstrings - Click “Create”
๐ Step 2: Localize Your Catalog
- Select the
.xcstringsfile in the navigator. - Go to File Inspector (right panel).
- Click โLocalizeโฆโ
- Choose the base language (e.g., English).
- Then click โ+โ to add other languages.
โ๏ธ Step 3: Add Translatable Strings
In code:
Text("welcome.message") // With localization
In your .xcstrings, this key (welcome.message) is added automatically if using String(localized:) in Swift.
Manually in JSON format:
{
"welcome.message": {
"localizations": {
"en": {
"stringUnit": {
"value": "Welcome to our app!",
"comment": "Shown on the welcome screen"
}
},
"fr": {
"stringUnit": {
"value": "Bienvenue dans notre application!",
"comment": "Affichรฉ ร l'รฉcran de bienvenue"
}
}
}
}
}
๐ Step 4: Export for Translation
- In Xcode: Product โ Export for Localization
- Choose
.xliffformat for translators - Share and later re-import using Product โ Import Localizations
๐งช Step 5: Test Translations
- Run your app
- Change the device or simulator language
- Verify the localized content appears correctly