L20n by example

8. Variants

As we stated at the beginning of this tutorial, an entity primarely consist a string value. But there are cases, in which it makes sense to store multiple variants of the value. The brandName example, in languages that use noun declension, may need to be declined when referred from other entities.

Select expression, introduced in one of the previous chapters, does not provide a way to easily refer to a particular variant of the value from another entity. Instead, L20n lets you define traits, which are variants of the whole value that can be externally referred to using key[trait] syntax.

For instance in many inflected languages (e.g. German, Finnish, Hungarian, all Slavic languages), the about preposition governs the grammatical case of the complement. It might be the accusative (German), ablative (Latin) or locative (Slavic languages).

In Slovenian, the ideal string would inflect the noun, like so: O Aurori. However, since we want the name of the browser to be stored in the brandName entity, we can't modify it.

The work-around is to inflect an auxiliary noun complement, e.g. browser, to give About the Aurora browser. Needless to say, this ends up being long and often unnaturally-sounding to the native speakers. See about-old for the example in Slovenian.

This problem can be easily solved by defining multiple variants of the brandName entity, to match different grammatical cases of the noun.

brandName = *[nominative] Aurora [genitive] Aurore [dative] Aurori [accusative] Auroro [locative] Aurori [instrumental] Auroro about-old = O brskalniku { brandName } about = O { brandName[locative] }