This guide explains how to use Lara CLI with Xcode String Catalogs (.xcstrings), the modern localization format introduced in Xcode 15.
Xcode String Catalogs are JSON-based files that store all locales in a single file. They replace the traditional .strings + .stringsdict workflow with a unified format managed by Xcode's String Catalog editor.
Unlike .strings and .stringsdict files (which use one file per locale), .xcstrings files contain translations for all languages in one place.
Lara CLI supports .xcstrings files with:
- Simple string translations
- Plural variations (zero, one, two, few, many, other)
- Non-translatable entries (
shouldTranslate: false) - Metadata preservation (extractionState, comments)
To configure Xcode String Catalogs in your lara.yaml:
files:
xcode-xcstrings:
include:
- "Localizable.xcstrings"
exclude: []
lockedKeys: []
ignoredKeys: []Note: The configuration key is
xcode-xcstrings. Since all locales are stored in one file, the path does not contain a[locale]placeholder.
files:
xcode-xcstrings:
include:
- "Localizable.xcstrings"
- "Sources/InfoPlist.xcstrings"Since .xcstrings files contain all locales, there is only one file per catalog:
MyApp/
Localizable.xcstrings (contains en, fr, es, de, etc.)
InfoPlist.xcstrings (contains en, fr, es, de, etc.)
{
"sourceLanguage": "en",
"version": "1.0",
"strings": {
"app_name": {
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "My App"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Mon Application"
}
}
}
}
}
}{
"item_count": {
"localizations": {
"en": {
"variations": {
"plural": {
"one": {
"stringUnit": {
"state": "translated",
"value": "%lld item"
}
},
"other": {
"stringUnit": {
"state": "translated",
"value": "%lld items"
}
}
}
}
}
}
}
}{
"CFBundleName": {
"shouldTranslate": false,
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "MyApp"
}
}
}
}
}Entries with "shouldTranslate": false are preserved but not sent for translation.
Lara CLI flattens .xcstrings entries into key paths:
Simple strings:
"app_name"->"My App""hello"->"Hello World"
Plural variations:
"item_count/one"->"%lld item""item_count/other"->"%lld items"
Lara CLI automatically:
- Reads all locales from the single file
- Translates entries for each target locale independently
- Sets the
statefield to"translated"for new translations - Preserves
sourceLanguage,version, and other metadata - Preserves
shouldTranslate: falseentries unchanged - Preserves
extractionStateandcommentmetadata - Maintains JSON formatting (indentation)
- Preserves existing translations for locales not being updated
files:
xcode-xcstrings:
include:
- "Localizable.xcstrings"
lockedKeys:
- "app_name" # Lock specific key
- "item_count/one" # Lock specific plural form
ignoredKeys:
- "debug_*" # Ignore all debug keysversion: "1.0.0"
project:
instruction: "iOS app, professional tone"
locales:
source: en
target:
- fr
- de
- ja
files:
xcode-xcstrings:
include:
- "Localizable.xcstrings"
- "InfoPlist.xcstrings"
lockedKeys:
- "CFBundleName"
ignoredKeys: []
fileInstructions:
- path: "Localizable.xcstrings"
instruction: "User-facing messages"- Run
lara-cli initto create your configuration - Ensure your file paths match the
includepatterns - Run
lara-cli translate - Continue developing - Lara CLI tracks changes to the source language entries
If starting fresh:
- Create your
.xcstringsfile with source language entries - Run
lara-cli translate- target locale entries are added to the same file
- Device variations (
variations.device) are not currently supported - Substitutions are not currently supported
- The
shouldTranslate: falseflag must be set at the string entry level - Files must follow the standard
.xcstringsJSON format
- Verify the source language entries exist in the
localizationsobject - Check that
sourceLanguagematches your configured source locale - Ensure entries don't have
shouldTranslate: false
- Lara CLI only updates entries that have changed in the source language
- Use
ignoredKeysto prevent specific entries from being re-translated - Unchanged source entries keep their existing translations
- Lara CLI detects and preserves the original indentation
- If formatting differs, verify Xcode hasn't reformatted the file
- Supported Formats - Overview of all supported file formats
- Files Configuration - General file configuration options
- Xcode Strings Files - Traditional .strings format
- Xcode Stringsdict Files - Traditional plural format