How can I add variables to my translations?

In this article, you'll learn how to use the variable feature. It will explain when and why it's beneficial and provide instructions on configuring it.



  1. Understanding the Variable Feature and Its Usage
  2. Setting Up Variables
  3. Saving Time with Merged Similar Translations

1. Understanding the Variable Feature and Its Usage

Weglot simplifies translation by converting original content to its translated version and reusing translations from your Translation List. This feature is handy when you have identical content across multiple pages, as Weglot translates it once for all occurrences. However, similar but not identical content can result in multiple translations, thus increasing the total word count. The variable feature in Weglot helps to amalgamate these translations into a single one using a variable, thereby reducing your word count.


For example, if you have content such as" Order #324", "Order#325" and so on, or if a client is logged in to your website and if you display a message such as "Hello John," you may have several translations like the following:

In this case, the variable feature will allow you to aggregate all of those translations into a single one with a variable to reduce your word count. For instance, here's what the result looks like with a variable:

2. Setting Up Variables

To set up a variable, hover over a translation to find the "See details" button, which reveals the translation's information panel. Click on it to access the panel.

From there, access the "Variables" tab.

Click on "define variables."


Highlight the content you wish to transform into a variable. For example, to replace a customer's name, highlight it directly or double-click for single-word content.

Then, name your variable (like "CustomerName") and select a type (like "Alphabetical Only" for character-only content). Please note that you can name the variable as you prefer as long as it doesn't contain any special characters.

Finally, click "Add variable" to preview all the translations related to your variable.

After previewing and ensuring the variable's accuracy, click "Save" to finalize it.

This preview allows you to ensure that your variable is valid and matches the correct translations. These matched translations will be deleted when you click "Save" and replaced with a unique translation containing a variable. If everything is alright, click "Save," and you're done.

You have now set up a variable that reduces your word count. You can still manually edit the translation if necessary (see How to edit my translations).


3. Saving Time with Merged Similar Translations

This feature allows you to merge similar translations swiftly and efficiently, reducing your translated word count. For instance, variations like "reviewed by three people," "reviewed by ten people," etc., can be merged into a single translation by setting numbers as variables. Remember that the actual content within the variable remains untranslated.

To use this feature:

  1. Go to your Translation List and select a language pair.
  2. Click on "Actions" and choose "View variable suggestions".

  1. Review the suggested variables and details.

  2. Use the "Merge translations" option to combine them.

That's it! You have completed the process.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us