Interpolation
Inserting dynamic values (variables) into translation strings at runtime.
Definition
Interpolation is the process of inserting dynamic values into translation strings. Instead of hardcoding values like 'Welcome, John', you use placeholders: 'Welcome, {name}'. At runtime, the i18n library replaces {name} with the actual value. This allows the same translation to work with any user's name while preserving proper word order across languages.
Examples
- →'Hello, {name}!' → 'Hello, Maria!'
- →'You have {count} new messages' → 'You have 5 new messages'
- →'{user} invited you to {team}' → 'John invited you to Engineering'
Frequently Asked Questions
What placeholder syntax should I use?
It depends on your i18n library. Common formats: {name} (ICU/most libraries), {{name}} (Handlebars-style), %{name} (Ruby-style), %s (printf-style). Stick to one format per project.
How do translators know what values will be inserted?
Good practice: provide context comments explaining each variable. TMS platforms like IntlPull let you add descriptions: '{count} = number of unread messages'. Some show example values in preview.