Localizable.xcstrings is Apple's modern JSON-like format for translations in Xcode, introduced at WWDC 2022. It's the successor to Localizable.strings and provides enhanced features for managing translations in iOS, macOS, and other Apple platforms.
Localizable.xcstrings is a JSON-like format introduced by Apple at WWDC 2022 for localization purposes in Xcode. It includes translations for all messages used in macOS, iOS, and other Apple platform applications. Unlike the traditional Localizable.strings format, xcstrings is more structured and includes comprehensive information about translation state, comments, source language, variations, pluralization, and device-specific translations all in a single file.
{
"version": "1.0",
"sourceLanguage": "en",
"strings": {
"hello_world": {
"shouldTranslate": true,
"comment": "Main greeting message for users",
"extractionState": "manual",
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Hello World"
}
},
"es": {
"stringUnit": {
"state": "translated",
"value": "Hola Mundo"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Bonjour le monde"
}
}
}
}
}
}
Every xcstrings file contains all translations for all supported languages in a single file. This is a major improvement over the traditional approach where each language required its own separate .strings file in different lproj directories. The format includes metadata like translation states, extraction information, and developer comments that help coordinate translation workflows.
The xcstrings format provides several improvements over the traditional .strings format:
One of the most powerful features of xcstrings is support for device-specific translations. You can provide different translations for different Apple devices, allowing for optimized user experiences across platforms.
{
"version": "1.0",
"sourceLanguage": "en",
"strings": {
"search_action": {
"comment": "Search action that varies by device",
"extractionState": "manual",
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Find"
}
},
"de": {
"variations": {
"device": {
"mac": {
"stringUnit": {
"state": "translated",
"value": "Suchen"
}
},
"iphone": {
"stringUnit": {
"state": "translated",
"value": "Finde"
}
},
"other": {
"stringUnit": {
"state": "translated",
"value": "Suche"
}
}
}
}
}
}
}
}
}
Available device variants include: mac
, iphone
, ipad
, watch
, tv
, and other
for fallback cases.
Unlike traditional .strings files, xcstrings includes native pluralization support without requiring separate .stringsdict files.This makes managing plural forms much more straightforward and keeps all localization data in one place.
{
"version": "1.0",
"sourceLanguage": "en",
"strings": {
"item_count": {
"comment": "Number of items in cart",
"localizations": {
"en": {
"variations": {
"plural": {
"zero": {
"stringUnit": {
"state": "translated",
"value": "No items"
}
},
"one": {
"stringUnit": {
"state": "translated",
"value": "%lld item"
}
},
"other": {
"stringUnit": {
"state": "translated",
"value": "%lld items"
}
}
}
}
},
"pl": {
"variations": {
"plural": {
"zero": {
"stringUnit": {
"state": "translated",
"value": "Brak przedmiotów"
}
},
"one": {
"stringUnit": {
"state": "translated",
"value": "%lld przedmiot"
}
},
"few": {
"stringUnit": {
"state": "translated",
"value": "%lld przedmioty"
}
},
"many": {
"stringUnit": {
"state": "translated",
"value": "%lld przedmiotów"
}
},
"other": {
"stringUnit": {
"state": "translated",
"value": "%lld przedmiotów"
}
}
}
}
}
}
}
}
}
Supported plural forms include: zero
, one
, two
, few
, many
, and other
. Different languages use different combinations of these forms based on their grammatical rules.
The xcstrings format includes sophisticated state management for tracking translation progress. Each translation can have different states that help coordinate translation workflows and identify what needs attention.
The extractionState
field tracks how the translation was discovered: extracted_with_value
for automatically extracted strings, manual
for manually added translations, or migrated
for translations converted from other formats.
Setting up xcstrings in your iOS or macOS project is straightforward and provides immediate benefits over the traditional .strings approach. Xcode provides excellent tooling support for managing xcstrings files.
File → New → File → Resource → String Catalog
Name: Localizable
Target: [Your App Target]
Location: [Your Project Directory]
Project → [Target] → Info → Localizations
✓ English (Development Language)
✓ Spanish
✓ French
✓ German
✓ Polish
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var messageLabel: UILabel!
@IBOutlet weak var actionButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
titleLabel.text = NSLocalizedString("welcome.title",
comment: "Welcome screen title")
messageLabel.text = NSLocalizedString("welcome.message",
comment: "Welcome message for new users")
actionButton.setTitle(NSLocalizedString("action.continue",
comment: "Continue button text"),
for: .normal)
}
func showItemCount(_ count: Int) {
let format = NSLocalizedString("item.count",
comment: "Number of items in cart")
messageLabel.text = String.localizedStringWithFormat(format, count)
}
}
NSLocalizedString
in your Swift code just like with traditional .strings files. Xcode will automatically extract these strings and add them to your xcstrings file with the appropriate metadata and extraction state.String Catalog Editor:
• Add translations for multiple languages
• Configure plural variations (zero, one, few, many, other)
• Set device-specific variants (iPhone, iPad, Mac, etc.)
• Add translator comments and context
• Mark translation states (translated, needs review, etc.)
• Extract strings from code automatically
• Search and filter translations
Apple provides tools to help migrate from the traditional .strings format to the modern .xcstrings format.The migration process preserves your existing translations while adding the enhanced capabilities of the new format.
Xcode can automatically convert your existing Localizable.strings files to the xcstrings format:
SimpleLocalize automatically converts xcstrings device variants and pluralization to standard ICU message format.This allows you to export your translations to other file formats while maintaining the advanced features of xcstrings.
# Device variant conversion
Original xcstrings: mac="Click here", iphone="Tap here", other="Press here"
ICU format: {DEVICE, select, mac {Click here} iphone {Tap here} other {Press here}}
# Pluralization conversion
Original xcstrings: zero="No items", one="%lld item", other="%lld items"
ICU format: {COUNT, plural, zero {No items} one {%lld item} other {%lld items}}
This conversion enables you to use xcstrings as your primary format while still being able to export to other platforms and frameworks that use different localization systems.
Localizable.xcstrings files are used across all Apple platforms and development environments. The format is supported by Xcode 14+ and works with all Apple operating systems and frameworks.
If you split translations into multiple files in your application, you can use namespaces in SimpleLocalize to manage them separately. This allows you to organize translations by feature, module, or any other logical grouping while still taking advantage of the xcstrings format benefits.
Project structure:
Localizable-Auth.xcstrings # Authentication features
Localizable-Settings.xcstrings # Settings and preferences
Localizable-Messages.xcstrings # Chat and messaging
Localizable-Main.xcstrings # Core app features
SimpleLocalize CLI commands:
simplelocalize upload --uploadFormat localizable-xcstrings --uploadPath ./Localizable-{ns}.xcstrings
simplelocalize download --downloadFormat localizable-xcstrings --downloadPath ./Localizable-{ns}.xcstrings
To get the most out of the xcstrings format, follow these best practices:
Managing xcstrings files across multiple languages and team members requires proper workflow coordination.While the single-file approach simplifies some aspects, you still need tools to handle collaboration, updates, and quality assurance. SimpleLocalize provides comprehensive support for xcstrings files with features designed for modern localization workflows.
With SimpleLocalize, you can upload your xcstrings files, collaborate with translators using our web-based editor, leverage auto-translation for new content, and download updated files with all the advanced xcstrings features intact. Our platform preserves device variants, pluralization, and metadata while providing additional workflow features like comments, reviews, and automation.
Your partner in managing translations and localization workflow.
Web-based translation editor with full support for Localizable.xcstrings advanced features.
Translate your application into multiple languages with just a few clicks. Choose from OpenAI ChatGPT, Google Translate or DeepL translation providers to translate your texts. Adding support for new languages has never been easier.
Learn more about auto-translationWith SimpleLocalize CLI you can manage your translations from the terminal. It's a powerful tool that helps you to automate the translation process in your project. You can easily synchronize translation files between you local project and SimpleLocalize Translation Editor, start auto-translation or publish changes to the production environment.
CLI documentation# upload source translations
$ simplelocalize upload
# auto-translate strings
$ simplelocalize auto-translate
# download translated files
$ simplelocalize download
Engage your community in the translation process with public suggestions. Let users propose improvements directly, helping you refine translations and build engagement. Enable public suggestions for your project, share the link, and start collecting input.
Learn how to collect translation suggestionsGreet your customers
in their native language
See the latest news from our blog, including product updates, tutorials, and more.
Skip manual edits. Learn how to auto-translate YAML files with SimpleLocalize using upload, batch MT, and CI/CD so every push ships with fresh translations.
Learn how to translate YAML files easily for app or website localization. Step-by-step guide with examples, best practices, and tools like SimpleLocalize.
SimpleLocalize GitHub App is now live! Connect your repository, add simplelocalize.yml and automate uploading & downloading translations with pull requests.
Should you use YAML or JSON for translation files? Let's compare their key differences, pros and cons, and best practices to help you choose the right format for your localization project.