Skip to main content
All CollectionsTranslation Quality ToolsTranslation Memory
Translation Memory and platform-specific placeholders
Translation Memory and platform-specific placeholders

Translation Memory handles placeholders across formats, ensuring consistent translations and accurate matches.

P
Written by Product Team
Updated over 3 weeks ago

Overview

Translation Memory (TM) in Transifex ignores placeholders from Fill-Ups and Suggestions for source strings in Android, iOS, and other file formats. This ensures platform-specific placeholder differences do not affect 100% of text matches, providing consistent and accurate results.

Key benefits

  • Improved Matching: TM ignores differences in placeholder styles, enabling perfect matches across platforms.

  • Time Savings: More 100% matches lead to faster translations.

  • Consistency: Placeholder adjustments ensure uniformity in translations.


How it works

Case #1: Transifex standardizes placeholders, ensuring consistency in translation, even when placeholder formats differ. For example:

  • Android: Hello %s you have %d/%d calls

  • iOS: Hello %1$@ you have %2$@/%3$@ calls

The text "Hello <placeholder> you have <placeholder>/<placeholder> calls" is treated as identical in both apps, even with different placeholder formats. If one version is translated, Transifex will automatically apply the translation to the other (if fill-ups are enabled) and return a 100% TM match in the editor.

📝 Note: The “project/resource” link in a suggestion directs you to the most recent string in the editor where the specific TM suggestion was used. For 100% and 101% TM matches used in the string you’re viewing, the link will direct you to the same string in the following cases:

  • If the string contains placeholders

  • If it’s the most recent string used

Case #2: When comparing a string with placeholders to one without, even if the translatable text is identical, they are treated as different. For example:

  • Android: Hello %s you have %d/%d calls

  • iOS: Hello %1$@ you have %2$@/%3$@ calls

  • Android or iOS: Hello you have calls

The first two are treated as a 100% match, while the last is not due to the absence of placeholders.

Case #3: Textual differences (e.g., punctuation) when placeholders are present. For example:

  • Android: Hello %s you have %d/%d calls

  • iOS: Hello %1$@ you have %2$@/%3$@ calls!

The actual translatable text in the two strings differs due to the presence of the exclamation mark ("!") at the end of the second string. For fuzzy text matches, the system takes placeholders into account when determining the best match.


Supported placeholder groups and file formats

Transifex uses placeholder patterns to detect variables in translation strings. These placeholders often depend on the platform or language the file is designed for. Below, we outline placeholder groups, which represent common patterns across platforms and formats. This approach allows for flexibility, acknowledging that some file formats (e.g., XLIFF) may support multiple groups depending on their use case (e.g., iOS vs. Android). The following table organizes the groups, file formats, and their respective placeholders:

Group

File Formats

Placeholders

Group 1: Apple-Specific

STRINGS, STRINGS_UTF8, STRINGSDICT, XLIFF (when used for iOS/macOS)

%1$s, %(key1)s, %s, %@, %d, %.2f, %-5d, %+2d

Group 2: JSON, PHP-Based, Android, and XLIFF

KEYVALUEJSON, STRUCTURED_JSON, PHP_ALT_ARRAY, PHP_ARRAY, PHP_DEFINE, PHP_INI, ANDROID, XLIFF (when used for Android)

%1$s, %(key1)s, %s, %d, %.2f, %-5d, %+2d

Group 3: PO and YAML

PO, YML, YML_KEY, YML_LEGACY, YAML

%1$s, %(key1)s, %s, %d, %.2f, %-5d, %+2d, %{word}

Group 4: Live Formats

LIVE

{{1}}, {{12134}}

Group 5: RESX/RESW

RESX, RESW

{1}, {12134}

Group 6: Chrome-Specific

CHROME

$1, $1456868, $asdfg$, $@ggg$

Examples of placeholder use in XLIFF files

Example 1: XLIFF for iOS

File Format: XLIFF

Platform: iOS

String in Source Language:

<trans-unit id="welcome_message">
<source>Welcome, %@!</source>
<target>Bienvenido, %@!</target>
</trans-unit>

Placeholder Detected: %@

Explanation: In this case, the placeholder %@ indicates that the string originates from an Apple-specific context (e.g., iOS or macOS). Placeholders like %@ are typical for Apple platforms because they are used in Objective-C and Swift for dynamically substituting variables (e.g., user names or other content).

How it works: The detection logic in Transifex identifies the %@ placeholder pattern and associates the string with Group 1: Apple-Specific Formats, regardless of the file type. Even though the file format is XLIFF, the placeholder %@ is what determines that the string belongs to Group 1.

Example 2: XLIFF for Android

File Format: XLIFF

Platform: Android

String in Source Language:

<trans-unit id="price_message">
<source>The price is %1$s.</source>
<target>El precio es %1$s.</target>
</trans-unit>

Placeholder Detected: %1$s\

Explanation:
The placeholder %1$s is a format string commonly used in Android development (Java or Kotlin). It allows dynamic substitution of strings, such as inserting a price or other content into a sentence.

How it works: Transifex detects the placeholder %1$s and classifies the string under Group 2: JSON, PHP-Based Formats, Android, and XLIFF.
Here, the placeholder pattern—not the file type—determines the group. Although XLIFF is a general-purpose file format, the content's platform-specific usage (Android) defines the placeholder style.


💡Tip

Looking for more help? Get support from our Transifex Community Forum!

Find answers or post to get help from Transifex Support and our Community.

Did this answer your question?