How to use localization variables in Respresso

Respresso supports localization variables (aka. parameters or placeholders) but lets you handle them yourself is you already have a custom solution.

Platform independent localization variables are a hard thing as most formats has its own syntax and features. For this reason, Respresso tries to find a common ground but give you enough freedom to define custom placeholders.

Please note that to add, edit or delete localization variables, you need at least the Project Editor role. (There are no extra role requirements to reference variables from the translations other than what is required to edit the translations.)

What are localization variables and how to use them?

To ensure that Respresso's localization variable handling does not interfere with any other format you may want to use, it does not have a syntax that always means a variable. Only registered variables are handled by Respresso, anything other is treated as regular text.

Registered variables can be referenced from the text by the following syntax: {{ variable_name }}

This is treated only as a variable if there is a variable registered for that localization resource (key) with the variable_name name. Otherwise, it does not mean anything special for Respresso.

Using the default configuration, in a localization like Hi {{name}}! Respresso will replace the registered name variable placeholder with the following format specific versions:

Target formatConverted placeholderResulting text
Android%sHi %s!
iOS%@Hi %@!
Web (JSON){{ name }}Hi {{ name }}!

There are other supported formatting options than plain string values for Android and iOS. You can read more about variable formatting in Respresso.
You can also override the format specific variable placeholders, including the formatting globally or at resource level.

Register localization variables manually

To register a localization variable manually, you have to follow the following steps in the localization screen:

  1. Click the localization's key to open it in the editor panel.
  2. Click the + button next to the Variables section.
  3. Give a meaningful name for the variable in the newly opened dialog. (This name will be used for referencing the variable and this will be used for formats with named variables.)
  4. Optionally add a description for translators, change the variable formatting, and define custom placeholders.
  5. Register the new variable by clicking the OK button.
Steps to register a localization variable manually

Register localization variables the way you are used to it

Respresso recognises a wide variety of variable formats, so it can make variable registration convenient. You can easily register a suggested variable when Respresso recognises it in your translation by following these steps:

  1. Click the localization's key to open it in the editor panel.
  2. Type a variable placeholder in the translation using any of the supported syntaxes.
  3. Click the + button next to the suggested variable you want to register.
  4. Optionally you can change the auto-created variable settings. Like name, description, formatting or custom placeholders. Don't forget to click the OK button to apply your changes.
Steps to register suggested localization variables

Register localization variables by importing them

You can import localizations to Respresso by uploading your existing localization files. Each time you import a localization file, you can decide whether to import variables or keep them in the original form without registering them.

Respresso will do its best to automatically set up your variables correctly but you may need to change variable settings after the import. To do so, you need to manually check them. A nice trick is to filter localizations for {{ so it will show you only the ones with Respresso variables.

Filter localizations with variables to check imported variables

Rename a localization variable

There are a few cases when you need to rename your variables. E.g. after adding a suggested variable that does not contain a name (Android or iOS format) or you change variable handling in your app.

When you rename a variable, Respresso automatically refactors your references to it. (It's immediate for the current language whilst translations will be changed only during the save.) There are cases (like switching two variables) when you don't want to refactor previous variable references just rename it. This is why Respresso lets you disable the refactoring.

Rename a registered localization variable