Skip to content

Supported Placeholders

Placeholders (also known as variables, interpolations, or format specifiers) are special tokens in source strings that are replaced with dynamic content (like names, numbers, or dates) when the application runs. It’s crucial that these placeholders are not translated and that their syntax remains correct in the translated strings.

Crowdin Enterprise automatically recognizes and highlights common placeholder formats in the Editor. This helps translators easily identify non-translatable text and prevents accidental modification. The Variables QA check uses these recognized formats to ensure consistency between source and translation.

Here’s how placeholders work in practice:

Source string:

Welcome, %{name}! You have {count} new messages.

In the Editor:

  • %{name} and {count} are highlighted as placeholders
  • Translators know not to modify these tokens

Translated string (Spanish):

¡Bienvenido, %{name}! Tienes {count} mensajes nuevos.

The placeholders remain unchanged, ensuring your application can properly insert the user’s name and message count.

Use this table to quickly identify which format category your placeholders belong to:

FormatExampleCommon Use Cases
Printf-style%s, %d, %1$sC, PHP, Python, Java, Android XML
ICU / Brace style{0}, {name}, {0:C2}.NET, Java, JavaScript (i18n)
PHP variables$variable, $array['key']PHP templates
Ruby/Rails%{name}, #{variable}Ruby on Rails i18n
Twig{{ variable }}, {% trans %}Symfony, Drupal
Freemarker${variable}, <#if>Java templates
Custom__placeholder__, %variable%Various frameworks

Crowdin Enterprise recognizes a wide variety of placeholder formats commonly used in different programming languages, frameworks, and localization standards. Below are examples grouped by common styles.

When to use: C-based languages, Android XML strings, iOS .strings files, Python with % formatting, PHP sprintf.

These formats typically start with % and can include flags, width, precision, and type specifiers.

Example in context:

String in code: "User %s rated your post %d/5 stars"
In the Editor: "El usuario %s calificó tu publicación %d/5 estrellas"

Common Type Specifiers:

%d, %i // Integer
%u, %x, %X, %o // Unsigned Integer, Hexadecimal, Octal
%f, %F, %e, %E, %g, %G // Float / Double
%s // String
%c // Character
%b // Binary
%p, %zx // Pointer address / Hexadecimal
%@ // Objective-C object
%a, %A // Hexadecimal float
%ld, %li // Long integer
%lf // Long float (double)
%lu, %lx, %lX // Long unsigned integer
%n // Newline (in some contexts)
%h // Short integer (in some contexts)
%l // Long integer (alternative)
%M // Minutes (date/time context)
%P // AM/PM (date/time context)
%S // Uppercase 's' type (e.g., used in Android XML)
%H // Hour (date/time context)

Positional Arguments (e.g., Java, PHP):

%1$s, %2$d // Argument 1 is string, Argument 2 is integer
%3$s, %2$s // Re-using arguments
%1$d, %2$d, %3$d // Multiple integer arguments
%4$s // String argument
%1$S, %2$S, %3$S // Uppercase 'S' type with position
%5$tD, %5$tR // Java date/time formatting
%6$tD, %6$tR
%1$#@var@ // Custom/complex format (example 'var' kept for illustration)

Width, Precision, Flags, and Padding:

%10s // Minimum width 10
%.5f // Precision 5 for float
%10.5f // Width 10, Precision 5
%04d // Pad with zeros to width 4
%-10s // Left-align within width 10
%+d // Always show sign (+ or -)
%.*s // Dynamic precision from argument
%.*f // Dynamic precision for float
%*.*f // Dynamic width and precision from arguments
%#o // Alternate form (e.g., leading 0 for octal)
%1$-4d // Positional, left-aligned, width 4
%+4d // Show sign, width 4
%+-4d // Show sign, left-aligned, width 4
%-4d // Left-aligned, width 4
%-014d // Left-aligned, zero-padded, width 14
%05.2f // Zero-padded width 5, precision 2
%05d // Zero-padded width 5
%08x // Zero-padded width 8, hex
%010.2f // Zero-padded width 10, precision 2
%4.1s // Width 4, precision 1 for string
%-d // Left-aligned integer
%10.10s // Width 10, precision 10 for string

Named Arguments (e.g., Python):

%(name)s
%(count)d
%(placeholder) // Name without type specifier

Date/Time (e.g., strftime):

%Y-%m-%d
%H:%M:%S // Note: Might be interpreted as separate %H, %M, %S
%G-%m-%d %I:%M %p // Note: Complex combinations
%B %-e, %Y

Specific/Uncommon Printf Variations:

%1F, %2 // May depend on specific parsers
%1d // May depend on specific parsers
%NEWLINE% // Common in some specific file formats

When to use: .NET applications, Java MessageFormat, JavaScript i18n libraries, React Intl.

These formats typically use curly braces ({ }).

Example in context:

String in code: "Hello {name}, your balance is {amount, number, currency}"
In the Editor: "Hola {name}, tu saldo es {amount, number, currency}"

Indexed Arguments:

{0}, {1}, {2}

Named Arguments:

{name}, {count}, {variable}
{index}
{item}
{placeholder}
{term}
{number} // Used as name
{6}, {4} // Numbers as names/indices

Formatted Arguments (ICU / .NET):

{0,number,integer}
{index,alignment:format}
{index,alignment}
{index:format}
{value, -10} // Alignment
{value, 6:N2} // Alignment and .NET numeric format
{0:C2} // .NET Currency format
{0:d} // .NET Short date format
{0:t} // .NET Short time format
{0,-10} // Alignment
{0,-12} // Alignment
{1,8:yyyy} // .NET Custom date format with alignment
{2,12:N0} // .NET Number format with alignment
{3,8:yyyy}
{4,12:N0}
{5,14:P1} // .NET Percentage format with alignment
{0,12:C2}
{0,12:E3} // .NET Scientific format
{0,12:F4} // .NET Fixed-point format
{0,12:N3} // .NET Number format
{1,12:P2} // .NET Percentage format

Simple Expressions (.NET):

{index+1}

Multi-Level Braces (e.g., Handlebars, other templating):

{string}
{{string}}
{{{string}}}
{{-6}} // Numbers within double braces

When to use: PHP templates, Laravel Blade (for variables).

Includes standard variables and object/array access.

Example in context:

String in template: "Welcome back, $user->name!"
In the Editor: "Bienvenido de nuevo, $user->name!"
$variable
$object->property
$array['key']
$array["key"]
{$variable} // Complex syntax
$_ // Special variable (also used in Ruby)
$y$, $x$ // Single letters within dollars (could be specific context)
$t$
$var$ // Variable name enclosed in dollars
$TAG_START$, $TAG_END$ // Often used for markup/tags

When to use: Python with .format() method or f-strings (represented after parsing).

Besides Printf-style and ICU-style, includes .format() style.

Example in context:

# In Python code: "Hello {name}, you have {count} items".format(name=user, count=5)
# In the Editor: "Hola {name}, tienes {count} elementos"
{0}, {1} // Indexed
{name} // Named

When to use: Ruby on Rails i18n, Ruby ERB templates.

Example in context:

# In Rails i18n: t('greeting', name: @user.name) => "Hello %{name}"
# In the Editor: "Hola %{name}"
%{name}
#{variable}
#{$$} // Special variable
$_ // Special variable (also used in PHP)

When to use: Symfony framework, Drupal CMS, Craft CMS.

Includes variables, filters, functions, and control structure tags.

Example in context:

{# In Twig template: "Welcome {{ user.name }}" #}
{# In the Editor: "Bienvenido {{ user.name }}" #}

Variable Output:

{{ variable }} // Simple variable
{{ object.property }} // Object property access
{{ array["key"] }} // Array access (double quotes)
{{ array['key'] }} // Array access (single quotes)
{{ function() }} // Function call
{{ variable|filter }} // Single filter
{{ variable | filter1 | filter2 }} // Chained filters
{{ attach_library('path/name') }} // Function call with string argument
{{ content|without('attribute') }} // Filter with string argument
{{ $php_variable["key"] }} // Accessing PHP-like variable inside Twig
{{ url('<route_name>') }} // URL function call
{{ value|true|false }} // Value with boolean filters

Tags / Blocks:

{% if condition %}
{% endif %}
{% trans %}
{% endtrans %}
{% block name %}
{% endblock name %}
{% if constant('CONSTANT_NAME') or variable != value %} // Complex condition
{% if variable is empty %}

When to use: Apache Freemarker templates (Java-based).

Uses ${...} for variable output and <#...> or </#...> for directives.

Example in context:

<!-- In template: "Hello ${user.firstName}" -->
<!-- In the Editor: "Hola ${user.firstName}" -->

Variable Output:

${variable}
${object.property}
${value}$ // Value within syntax

Directives:

<#if condition>
</#if>
<#elseif condition>
<#else>
<#recover>
<#include "/path/to/template.ftl">
<#list items as item>
</#list>

When to use: Various proprietary or legacy systems, custom frameworks.

Various other formats recognized by Crowdin Enterprise.

Example in context:

String: "Click __button_name__ to continue"
In the Editor: "Haz clic en __button_name__ para continuar"
&_var_& // Ampersand underscore
*|Object.Property|* // Pipe symbols
\(variable) // Backslash parentheses (Note: Backslash is part of the placeholder)
:placeholder: // Colons
$placeholder$ // Dollar signs
__placeholder__ // Double underscores (example: __count__)
&var& // Double underscores with ampersand content
$(variable) // Dollar parentheses
%%variable%% // Double percent signs
%variable% // Single percent signs (may overlap with Printf, used in Twig/other)
  • QA Checks - Learn how to configure validation rules for placeholders
  • Custom Placeholders - Define organization-wide custom placeholder patterns
  • Online Editor - See how placeholders are highlighted during translation
Was this page helpful?