Quick Summary
- Legacy format: .strings files are Xcode’s traditional localization format for simple key-value translations
- Language-specific: Each language requires a separate .strings file (e.g., en.strings, fr.strings)
- Simple structure: Plain text format with “key” = “value”; syntax
- Manual management: Developers must manually maintain and sync string files with code
- Limited features: Basic translations only – no built in pluralization or device variations
- Still supported: Works in all Xcode versions but largely superseded by String Catalogs
What is a .strings File?
A .strings file is Xcode’s traditional format for storing localized text in iOS apps. It’s a simple text file that maps string keys to their translated values using a straightforward “key” = “value”; syntax.
Each language in your app requires its own .strings file, typically named Localizable.strings
and placed in language-specific folders like en.lproj
for English or fr.lproj
for French.
File Structure and Syntax
A typical .strings file looks like this:
/* Login screen title */
"login_title" = "Welcome Back";
/* Button text for signing in */
"sign_in_button" = "Sign In";
/* Error message for invalid credentials */
"invalid_credentials" = "Invalid username or password";
Key Components:
- Comments: Lines starting with /* provide context for translators
- Key: Unique identifier (usually in quotes)
- Value: Translated text for the current language
- Semicolon: Each entry must end with a semicolon
How to Use .strings Files
In your Swift code, reference strings using:
// iOS 15+ (String Catalogs preferred)
let title = String(localized: "login_title")
// Legacy approach (all iOS versions)
let title = NSLocalizedString("login_title", comment: "Login screen title")
At runtime, iOS automatically loads the appropriate .strings file based on the user’s language settings.
Limitations
.strings files work well for basic translations but have significant limitations:
- Manual synchronization: No automatic detection of new strings in code
- No pluralization: Cannot handle singular/plural variations (requires separate .stringsdict files)
- File proliferation: Multiple files per language become difficult to manage
- No state tracking: No built-in way to track translation progress
- Merge conflicts: Binary format can cause version control issues
For complex localization needs like pluralization, you’ll need to use .stringsdict files alongside your .strings files, which handle advanced formatting and plural rules.
File Organization
Traditional .strings file organization looks like this:
MyApp/
├── en.lproj/
│ └── Localizable.strings
├── fr.lproj/
│ └── Localizable.strings
├── es.lproj/
│ └── Localizable.strings
└── de.lproj/
└── Localizable.strings
Each language folder contains identical file names with language specific translations.
Legacy vs Modern Approaches
.strings Files (Legacy) | String Catalogs (.xcstrings) |
---|---|
Separate file per language | Single file for all languages |
Manual string management | Automatic string detection |
Simple key-value pairs | Advanced features built-in |
Requires .stringsdict for plurals | Pluralization included |
All Xcode versions | Xcode 15+ (recommended) |
Best Practices
While .strings files remain functional, Apple’s newer .xcstrings format is rapidly becoming the preferred standard for iOS and macOS localization.
The .xcstrings format offers better Xcode integration, improved collaboration features, and enhanced support for pluralization and device variants.
We recommend adopting .xcstrings to take advantage of modern tooling and align with Apple’s current development ecosystem.