How to manage i18n in your views

Fasty allow you to manage your translations easily. It offer a simple UI to translate your content. How does it work ? 

<h1>Hello World</h1>

Let say we want to update this view to make it translatable. We have to modify it like that :

<h1>{{ tr | Hello World }}</h1>

That's it !

Refresh your view on your frontend website. The entry will be added to the admin trads UI.

Notice that the key must not contains ? character.

Interpolation

Ok now imagine that we want to translate this text below :

<span>You have 5 items in your cart</span>

We can now use a splat to define variables

<span>{{ tr | You have $(num) items in your cart | num/5 }}</span>

You can have any variables you want in your key

<span>{{ tr | $(one) $(two) $(three) | one/1/two/2/three/3 }}</span>

What about RiotJS web components ?

You can use it in your widgets too! It's very easy to make a regular view translatable!


Leave a comment