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
Keys are typically set up by your team of developers and should appear as string metadata as soon as your content is sent to Smartling for translation.
If keys are not automatically recognized, special instructions (called "file directives") can be added to your resource files before uploading them to Smartling. The correct file directives ensure that keys will be detected as searchable metadata.
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.