This guide explains how to use Lara CLI with Xcode .strings localization files, commonly used in iOS and macOS applications.
Xcode .strings files are the traditional format for storing localized strings in Apple applications. They use a simple key-value pair format organized by locale in .lproj directories (e.g., en.lproj/Localizable.strings, fr.lproj/Localizable.strings).
Lara CLI supports .strings files with:
- Simple key-value string pairs
- C-style comments (
/* ... */) - Escape sequences (
\",\\,\n,\t,\Uunicode)
To configure Xcode .strings files in your lara.yaml:
files:
xcode-strings:
include:
- "[locale].lproj/Localizable.strings"
exclude: []
lockedKeys: []
ignoredKeys: []Note: The configuration key is
xcode-strings(notstrings). Lara CLI automatically maps.stringsfile extensions to this config key.Important: Lara CLI uses
[locale].lproj/Localizable.stringsstructure (e.g.,en.lproj/Localizable.strings,fr.lproj/Localizable.strings). The[locale]placeholder is replaced with the locale code.
files:
xcode-strings:
include:
- "[locale].lproj/Localizable.strings"
- "[locale].lproj/InfoPlist.strings"This follows the structure:
MyApp/
en.lproj/
Localizable.strings
InfoPlist.strings
fr.lproj/
Localizable.strings
InfoPlist.strings
es.lproj/
Localizable.strings
InfoPlist.strings
files:
xcode-strings:
include:
- "Resources/[locale].lproj/Localizable.strings"/* App Name */
"app_name" = "My App";
/* Greeting message */
"hello" = "Hello World";
/* Button labels */
"button_submit" = "Submit";
"button_cancel" = "Cancel";
Each entry follows the format: "key" = "value";
C-style block comments and single-line comments are supported and preserved during translation:
/* Section: Login Screen */
"login_title" = "Welcome Back";
// Username field placeholder
"login_username" = "Enter your username";
"escaped_quotes" = "Say \"Hello\"";
"newline" = "Line 1\nLine 2";
"tab" = "Column 1\tColumn 2";
"backslash" = "C:\\Users\\file";
"unicode" = "\U00E9";
"empty_key" = "";
Lara CLI automatically:
- Extracts key-value pairs from
.stringsfiles - Preserves comments and their association with keys
- Maintains key ordering from the source file
- Handles escape sequences correctly
- Preserves file formatting
When using lockedKeys or ignoredKeys, use the key name directly:
files:
xcode-strings:
include:
- "[locale].lproj/Localizable.strings"
lockedKeys:
- "app_name" # Exact key
- "api_*" # Wildcard pattern
ignoredKeys:
- "debug_*" # Ignore all debug keysversion: "1.0.0"
project:
instruction: "iOS app, user-friendly tone"
locales:
source: en
target:
- es
- fr
- de
files:
xcode-strings:
include:
- "[locale].lproj/Localizable.strings"
- "[locale].lproj/InfoPlist.strings"
exclude: []
lockedKeys:
- "app_name"
ignoredKeys:
- "debug_*"
fileInstructions:
- path: "[locale].lproj/Localizable.strings"
instruction: "User-facing messages, friendly tone"- Run
lara-cli initto create your configuration - Ensure your file paths match the
includepatterns - Run
lara-cli translate - Continue developing - Lara CLI tracks changes via checksums
If your .strings files don't exist yet:
- Create your source locale file (e.g.,
en.lproj/Localizable.strings) - Run
lara-cli translate- target locale files are created automatically
- Must use
"key" = "value";format - Keys and values must be double-quoted
- Each entry must end with a semicolon
- Files must be organized by locale in
.lprojdirectories
- Ensure entries follow the
"key" = "value";format - Check that semicolons are present at the end of each entry
- Verify the file encoding is UTF-8
- Lara CLI preserves block comments (
/* ... */) and single-line comments (// ...) - Comments are associated with the entry that follows them
- Supported Formats - Overview of all supported file formats
- Files Configuration - General file configuration options
- Xcode Stringsdict Files - Plural support for Xcode
- Xcode String Catalogs - Modern Xcode 15+ format