When working with strings in Smartling, you might come across two different types of additional metadata: keys and variants.
Keys
Keys are string identifiers used by developers. They indicate where a string is going to appear on a website or in an application.
Example:
For example, a website might use a key such as “homepage.button” for a button that directs the user back to the homepage.
Each key gets paired up with a value. This is the actual text that is going to be displayed.
In our example, the value associated with the key “homepage.button” could be “Home” in English.
The use of keys facilitates the localization of websites and applications. The source value can easily be switched out for the translated text.
In the above example, the English value "Home" can be replaced with "Page d'accueil" for the French website. Since the key remains the same, the translated text will still be displayed in the correct spot.
This way of structuring the content as key-value-pairs is typical of resource files.
Smartling can recognize keys for all resource files and display them as string identifiers that can be searched for. The values represent the actual source text, which can be sent for translation.
How to set up keys
As outlined above, a key acts as a unique identifier for a string. Resource files often contain keys that help developers identify where a string will appear on a website or in an application. This information can also be helpful to non-technical users, as they can identify and locate strings in Smartling by searching for the key.
If your content has keys, make sure they are being picked up by Smartling. In some cases, this will happen automatically, but in others, it will require special instructions called file directives.
If keys are not automatically recognized in Smartling, you can add file directives to your resource files before uploading them to Smartling. Adding the proper file directives ensures strings are paired with the correct keys in Smartling.
Business files (Microsoft Word, Excel, and PowerPoint) do not support the use of keys as string metadata.
Variants
On the surface, variants usually look identical to keys. However, while keys are used in coding to identify and reference strings, variants serve a different purpose in the localization process.
Variants allow us to use and store two or more different translations for the same source text.
Example:
For example, in the context of a real estate business, the source string “Home” could be referring either to the homepage or to a house that is available for sale. Most languages would require very different translations for these two use cases.
As an added piece of meta information, different variants allow us to treat these two instances of the same source text as two completely separate strings. As a consequence, the translators can choose the correct wording based on the context, and we can store two different translations in your Translation Memory.
How to set up variants
For resource files, Smartling automatically uses the key also as the variant, which is why these two types of metadata look identical. This is done because strings displayed in different locations on a website or in an application may require different translations based on the exact context.
For business files, which don't support the use of keys, Smartling automatically creates separate variants if a file contains two or more strings with the same source text.
This allows the translators to use a different translation for each instance of the same source text, based on the context.
More information on how variants are created for each file type can be found here.