The iOS .strings format is the standard localization format for iOS applications, used to store key-value pairs for localizable text content.
What is iOS .strings format
The .strings
format is Apple's proprietary localization format used for iOS and macOS applications. It stores translations as simple key-value pairs in a human-readable text format.
Key characteristics
-
Simple syntax — Easy to read and edit manually
-
UTF-16 encoding — Supports all Unicode characters
-
Comment support — Allows documentation within files
-
Xcode integration — Native support in Apple's development tools
-
Case-sensitive keys — Key names must match exactly
File structure and syntax
Basic syntax
/* Comment describing the key */
"key_name" = "Translated text";
/* Another example */
"welcome_message" = "Welcome to our app!";
Key components
-
Comments — Optional descriptions using
/* */
syntax -
Key — Unique identifier in double quotes
-
Assignment — Equals sign
=
-
Value — Translated text in double quotes
-
Semicolon — Required at the end of each line
Complete example
/* Application name */
"app_name" = "My Awesome App";
/* Main screen texts */
"home_title" = "Home";
"settings_button" = "Settings";
/* User messages */
"login_success" = "Welcome back!";
"error_network" = "Network connection failed";
/* Buttons */
"button_save" = "Save";
"button_cancel" = "Cancel";
"button_delete" = "Delete";
Encoding and character support
UTF-16 encoding
iOS .strings files use UTF-16 encoding by default:
-
Full Unicode support — All languages and special characters
-
Byte Order Mark (BOM) — Often includes BOM for proper encoding detection
-
Cross-platform compatibility — Works across different operating systems
Special characters
/* Emoji and special characters work natively */
"success_message" = "✅ Success!";
"warning_text" = "⚠️ Warning: Check your input";
/* Unicode characters */
"currency_euro" = "€";
"copyright_text" = "© 2024 Company Name";
Comments in .strings files
Comment types
Single-line comments:
/* This is a comment for the next key */
"app_title" = "My App";
Multi-line comments:
/*
This is a longer comment
that spans multiple lines
and provides detailed context
*/
"complex_message" = "This message needs explanation";
Best practices for comments
Provide context:
/* Displayed when user successfully logs in */
"login_success" = "Welcome back!";
/* Error message when network is unavailable */
"network_error" = "Please check your internet connection";
/* Maximum 20 characters - appears in navigation bar */
"screen_title" = "Settings";
Include usage information:
/* Button text - should be action-oriented and concise */
"save_button" = "Save Changes";
/* Toast message - appears for 3 seconds */
"auto_save_enabled" = "Auto-save is now enabled";
Working with variables and placeholders
String formatting
iOS .strings format supports various placeholder types:
Positional arguments:
/* %@ for strings, %d for integers, %f for floats */
"welcome_user" = "Welcome, %@!";
"items_count" = "You have %d items";
"price_display" = "Price: $%.2f";
Positional with ordering:
/* Useful when word order changes between languages */
"user_score" = "%1$@ scored %2$d points";
"file_info" = "File %2$@ is %1$d MB";
Variable examples
/* User-related messages */
"user_greeting" = "Hello, %@!";
"user_points" = "%@ has %d points";
/* File operations */
"file_size" = "File size: %.1f MB";
"download_progress" = "Downloading... %d%%";
/* Time and dates */
"last_updated" = "Last updated: %@";
"time_remaining" = "%d minutes remaining";
Integration with Localit.io
Uploading .strings files
-
Select iOS .strings format in upload settings
-
Choose encoding — UTF-16 (default) or UTF-8
-
Enable comment preservation to keep existing comments
-
Set key validation to ensure proper syntax
Export settings
Standard export:
-
Maintains UTF-16 encoding
-
Preserves original formatting
-
Includes comments if available
Advanced options:
-
Custom encoding selection
-
Sort keys alphabetically
-
Add file header comments
Localit.io features for .strings
Automatic validation:
-
Syntax checking for proper format
-
Placeholder validation
-
Duplicate key detection
-
Encoding verification
Enhanced workflow:
-
Visual editor for key-value pairs
-
Comment management interface
-
Preview mode for formatted strings
-
Integration with iOS development workflow
File organization and naming
Standard naming convention
Base.lproj/Localizable.strings // Default language
en.lproj/Localizable.strings // English
es.lproj/Localizable.strings // Spanish
fr.lproj/Localizable.strings // French
de.lproj/Localizable.strings // German
Multiple .strings files
InfoPlist.strings // App metadata
Localizable.strings // Main app content
Error.strings // Error messages
Menu.strings // Menu items
Notifications.strings // Push notifications
Project structure example
MyApp.xcodeproj/
├── Base.lproj/
│ ├── Localizable.strings
│ ├── InfoPlist.strings
│ └── Storyboard.strings
├── en.lproj/
│ ├── Localizable.strings
│ └── InfoPlist.strings
├── es.lproj/
│ ├── Localizable.strings
│ └── InfoPlist.strings
└── fr.lproj/
├── Localizable.strings
└── InfoPlist.strings
Common patterns and examples
App metadata (InfoPlist.strings)
/* App name as it appears on home screen */
CFBundleDisplayName = "My App";
/* App description in App Store */
CFBundleGetInfoString = "The best app for productivity";
/* Copyright notice */
NSHumanReadableCopyright = "© 2024 Your Company";
User interface elements
/* Navigation */
"nav_home" = "Home";
"nav_profile" = "Profile";
"nav_settings" = "Settings";
/* Form labels */
"label_email" = "Email Address";
"label_password" = "Password";
"label_confirm_password" = "Confirm Password";
/* Action buttons */
"action_save" = "Save";
"action_cancel" = "Cancel";
"action_submit" = "Submit";
"action_retry" = "Try Again";
Status and feedback messages
/* Success messages */
"success_saved" = "Changes saved successfully";
"success_uploaded" = "File uploaded";
/* Error messages */
"error_invalid_email" = "Please enter a valid email address";
"error_password_short" = "Password must be at least 8 characters";
"error_network" = "Network error. Please try again.";
/* Loading states */
"loading_please_wait" = "Please wait...";
"loading_data" = "Loading data";
Best practices for iOS .strings
Key naming conventions
Use descriptive, hierarchical names:
✅ Good:
"login_button_submit" = "Log In";
"error_network_timeout" = "Connection timed out";
"profile_section_personal_info" = "Personal Information";
❌ Avoid:
"btn1" = "Log In";
"err" = "Connection timed out";
"text" = "Personal Information";
Content guidelines
Keep strings concise but clear:
✅ Good:
"delete_confirmation" = "Are you sure you want to delete this item?";
❌ Too verbose:
"delete_confirmation" = "Are you absolutely certain that you want to permanently delete this particular item from your list?";
Consider text expansion:
/* English: 12 characters */
"save_button" = "Save Changes";
/* German might be longer: ~20 characters */
"save_button" = "Änderungen speichern";
Technical considerations
Escape special characters properly:
"message_with_quotes" = "He said \"Hello!\"";
"message_with_newline" = "Line 1\nLine 2";
"message_with_backslash" = "Path: C:\\Documents";
Handle plurals appropriately:
/* Note: For complex plurals, use .stringsdict instead */
"items_singular" = "1 item";
"items_plural" = "%d items";
Troubleshooting common issues
Syntax errors
Missing semicolon:
❌ "key" = "value" // Missing semicolon
✅ "key" = "value"; // Correct
Unescaped quotes:
❌ "message" = "Say "Hello""; // Incorrect escaping
✅ "message" = "Say \"Hello\""; // Correct escaping
Encoding issues
Wrong encoding detection:
-
Ensure file is saved as UTF-16
-
Include BOM for proper detection
-
Verify special characters display correctly
Character corruption:
-
Check source file encoding
-
Validate during import process
-
Test on actual iOS devices
Xcode integration issues
Missing localizations:
-
Verify .lproj folder structure
-
Check Xcode project settings
-
Ensure files are added to target
Runtime string loading:
-
Confirm key names match exactly
-
Check for typos in NSLocalizedString calls
-
Verify file is included in app bundle
Migration and compatibility
From other formats
From Android XML:
<!-- Android -->
<string name="app_name">My App</string>
<!-- iOS equivalent -->
"app_name" = "My App";
From JSON:
// JSON
{
"app_name": "My App"
}
// iOS equivalent
"app_name" = "My App";
Legacy considerations
iOS version compatibility:
-
.strings format supported since iOS 2.0
-
UTF-16 encoding recommended for all versions
-
Xcode automatically handles format validation
Migration best practices:
-
Backup existing files before conversion
-
Validate syntax after importing
-
Test on multiple iOS versions
-
Verify special characters render correctly
Conclusion
The iOS .strings format provides a robust, standardized way to handle localization in iOS applications. With Localit.io's comprehensive support for this format, including automatic validation, comment preservation, and seamless Xcode integration, managing your iOS app's translations becomes efficient and error-free.
Key takeaways:
-
Simple yet powerful syntax for key-value translations
-
UTF-16 encoding ensures full Unicode support
-
Comment system enables better collaboration with translators
-
Xcode integration streamlines the development workflow
-
Best practices ensure maintainable and scalable localization