Numbering of placeholders in STRINGS files (iOS)
Introduction
One of the problems that you might report is that placeholders in a source STRINGS file have been converted to the ones that contain number tags in them, both in XTM Workbench as well as in a target file generated in the XTM Cloud UI.
For instance, the %@
placeholder is replaced by %1$@
, to become an inline tag.
This is expected behavior, based on the iOS strings file documentation!
How does the placeholder conversion work and what is the purpose?
According to the iOS localization documentation, it is highly recommended to include numbered variables during the translation process. This numbering helps the software identify and correctly position the variables in a translated string.
If a string contains single or multiple arguments, the translator can insert special tags of the form n$
(where n
specifies the position of the original argument) in between the formatting characters. These tags let the translator reorder the arguments that appear in the original string.
This practice is crucial for maintaining the integrity of the application’s functionality across different languages. In this way, we ensure that the translated strings align precisely with the original ones, allowing for a seamless transition between languages without compromising the application performance. It plays a significant role in preserving the logic and context associated with each variable, contributing to a more accurate and reliable localization outcome.
To learn more about the topic, read the following official page String Resources, the section Listing 2-4 Strings with formatting characters.
There is a special configuration that can be placed on the back-end side of your XTM Cloud instance, which disables auto numbering. However, this can only be done for stringsdict files!
Moreover, remember that when auto numbering is disabled, stringsdict target files might produce incorrect sentences because of changed order of inlines!
For STRINGS files, inline tags are numbered automatically, and there is no way to change this!