Apple iOS
LingoHub supports .strings and .stringsdict files for localizing iOS and macOS applications.
LingoHub also offers tight coupling between Apple iOS and Android projects to accelerate multi-mobile development. You can create one of these projects and export the translated resource files in the other format.
Format
- Key-value pairs are delimited with the
=character and terminated by a;semicolon. - Keys and values must be quoted.
- Newlines can be written directly in a quoted string or escaped using
\n. - Double quotes must be escaped using
\". - Single-line comments begin with
//. - Multi-line comments are enclosed in
/* ... */. - LingoHub exports comments using their original syntax (single-line or multi-line).
- Placeholder information is available in the Apple String Format Specifiers reference.
- LingoHub assigns comments to the subsequent key-value pair and uses them as segment descriptions.
- We recommend UTF-16LE character encoding, although LingoHub supports other standard encodings.
- The .stringsdict format uses XML to handle plural translations according to the Apple Plural Rules structure.
- LingoHub supports the
NSStringPluralRuleTyperule type. - The following rule types are not supported:
NSStringVariableWidthRuleTypeNSStringDeviceSpecificRuleType
LingoHints can be included in a comment:
/* <lh>{"status": "DRAFT","qc": {"min": "3","max": "20"},"labels": ["q3-2024"],"not_translatable": false}</lh> */
"3fl-p0-pxa.title" = "Title";Example
.strings
Additional example files are available on GitHub.
// This comment is parsed as a header comment.
"main.intro" = "The value holds the translated text.";
// Generic keys are recommended for cross-platform projects.
"page.main.title" = "Titel der Hauptseite";
/* Comments in .strings files
can be multi-line,
single-line */
// Or a combination of the two.
"hello_user" = "Hello %1$s";
// Keys and values can span multiple lines.
"welcome.message" = "Welcome back,
we have missed you";
// Comments belong to the next key-value pair.
"visit.count" = "This is your %1$d visit to our site.";.stringsdict
<plist version="1.0">
<dict>
<key>photos.count</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@photos@</string>
<key>photos</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>zero</key>
<string>No photos</string>
<key>one</key>
<string>1 photo</string>
<key>other</key>
<string>%d photos</string>
</dict>
</dict>
<key>days.remaining</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@days@</string>
<key>days</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>zero</key>
<string>No days remaining</string>
<key>one</key>
<string>1 day remaining</string>
<key>other</key>
<string>%d days remaining</string>
</dict>
</dict>
</dict>
</plist>To consider
Locale information
In Xcode projects, resource files do not require locale information in the filename (e.g., Localizable.strings). Instead, the locale is defined by the directory path. We recommend using the LingoHub SCM integration to synchronize your repository. Otherwise, you must specify the language manually during import.
If LingoHub detects a Base.lproj directory in the path and no other locale is specified, it associates the files with the project's source language.
Generic keys
While .strings files often use source language content as keys, LingoHub supports managing Android and iOS resources in a single project. We recommend using identical generic keys in both .strings and Android resource files to streamline multi-platform development.
References
Updated about 1 month ago
