.strings and .stringsdict files are what is used at runtime in iOS, iPadOS and MacOS apps. Both formats work out of the box with our SDK, Command Line Interface (CLI), as well as manual import and export on the dashboard.
String catalogs are a new feature introduced by Apple which conveniently detects and organizes translations for keys or hard-coded values used throughout the project. Xcode now has a new screen to manage that, and it works by scanning the source code and extracting these values. The process is performed as part of each build and any changes will be detected and updated.
Internally, Xcode stores those strings and translations into a .json file called Localizable.xcstrings
To preserve backward compatibility, Xcode automatically generates the previously used Localizable.strings
. These generated .strings files are the ones added to the bundle and loaded during runtime. This allows, for example, the SDK to also work seamlessly with string catalogs the same way as before without any additional work.
In Xcode, the Build Settings provide these flags to control the behavior for detecting strings for each target:
Use compiler to extract swift strings
: when disabled, only ObjC strings will be detected. This option can be used to disable extraction for each target separately.Localized String SwiftUI Support
: also includes values from SwiftUI views like Text
If you want to import strings from a String Catalog into the GlobalLink Strings dashboard, you need to export the strings into a Localization Catalog
.
A Localization Catalog can be generated by Xcode on demand. It contains all the localizable resources for each language and region found in the project.
It is a package (folder) with the .xcloc extension and it includes an .xliff and other files metadata to be used as a distributable package for sending off localizable content. The embedded .xliff file can be imported to the GlobalLink Strings dashboard manually or using the CLI.
The .xliff will be available for each language inside the Localized Contents
folder.
Since at runtime everything is converted to .strings and .stringsdict files, the SDK works out of the box no matter how you distribute your localizable content. The SDK automatically uploads the latest keys with translations when running in draft mode or when the debugger is connected. For more details on this, please see our SDK Documentation.
In order to import a String Catalog (.xcstrings) into the dashboard, it needs to be converted into a Localization Catalogs (.xcloc).
xcodebuild -exportLocalizations -project <projectname> -localizationPath <dirpath> [[-exportLanguage <targetlanguage>] ...]
Note: dirpath
will be created inside the project folder.
Afterwards you can upload the generated .xliff inside the Localization Catalog as outlined below.
xliff
, and make sure the path is inside the <dirpath>
used in step 1:{
"app": {
"access_token": ".....",
"base_language": "en",
"push": {
"source": [
{
"language": "en",
"file_format": "xliff",
"path": "YourProject Localizations/en.xcloc/Localized Contents/en.xliff",
}
]
}
}
}
applanga push
to upload.{
"app":{
"access_token":".....",
"base_language":"en",
"pull":{
"target":[
{
"file_format":"xliff",
"path":"./some/path/<language>.xliff",
"tag":"app:language.xliff"
}
]
}
}
}
Run applanga pull
command, this will download the .xliff to the path you set in the above .json.
Run the following command with the relevant parameter set for your project, and dirpath
used in step 1:
xcodebuild -importLocalizations -project <projectname> -localizationPath <dirpath>
For more details on the CLI configuration, please see the CLI documentation.
From Xcode, click the Product > Export Localizations menu option and select a path to save the output as a Localization Catalog.
Locate the .xliff file inside the Localized Contents folder of the generated Localization Catalogs (.xcloc) file. You can navigate into such a package by right clicking onto it and select Show Package Contents.
Upload the .xliff to your project
Follow the steps in our documentation on manual exports to generate an .xliff file
Start the Xcode import process by clicking on the Product > Import Localizations menu option and choose the .xliff for your required language
For more information see: https://developer.apple.com/documentation/xcode/importing-localizations#Import-localizations-using-Xcode
Master key naming conventions and file structure to help ensure a seamless localization process
Read the Full ArticleIt’s time to reflect on what we accomplished in 2024 and to find out what we’re working on in 2025
Read the Full Article