Skip to main content
Version: 3.x.x

Apple Strings and Stringsdict

Apple Strings and Stringsdict are used to localize strings in Apple platforms. The format is currently deprecated. However, we still recommend using it in favor of XLIFF since this Strings and Stringsdict gives you better control over the strings and their translations.

The .strings file is used to store simple strings, while .stringsdict is used to store only the plural values.

Example of a Strings file:


/* This is a comment */
"welcome_header_%@" = "Hello, %@";

/* This is a comment */
"user_settings_password_label" = "Password";

Example of a Stringsdict file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>Peter has one dog</string>
<string>Peter hase %lld dogs</string>

We recommend using the semantic keys format as in the examples above. That enables you to change the base values without modifying the actual key and doesn't suggest keeping the keys in sync with the base language translation.

The MessageFormat and placeholder conversion

When importing data to Tolgee from the Apple .strings and .stringsdict files, you can either enable or disable the conversion to the Tolgee Universal ICU placeholders. The conversion is enabled by default. You can also disable the conversion globally in the project settings. We recommend keeping the conversion enabled, as it brings many benefits. Read more about the benefits of Tolgee Universal ICU placeholders.

When the conversion is disabled, the original placeholders (e.g., %llm, %@). are preserved. The message format is automatically detected when importing data in Apple .strings and .stringsdict format. When exporting, you can choose from message & placeholder formats listed above.

Placeholder conversion specification

The official Apple's string format specifiers documentation can be found here.

Only specifiers specified in the table below are supported. Tolgee doesn't support additional flags and modifiers and placeholders using them are not converted.

SpecifierICU typeExampleConverted to ICUNote
%N/A%%%%% is the way how to render %, in ICU we don't have such concept, so we just add %. When exporting, the % is converted back to %%.
lldnumber%lld{0, number}
fnumber, [precision string]%f{0, number, 0.000000}By default %f uses 6 decimal places, that's why we convert it to the number with such precision. %.2 f would be {0, number, 0.00} and so on.
enumber, scientific%e{0, number, scientific}%E is not supported

If your placeholder is not supported, you can use %@ and format the string yourself in the code.

Apple also supports n$ positional specifiers. There are converted to as well as the zero based argument index. E.g. I am %2$@, and I have %1$lld dogs. is converted to I am {1} and I have {0, number} dogs.

Importing / Exporting in general

To read more about importing and exporting with Tolgee, continue to import section or export section.