I've decided to make texts _inside views_ translatable with plugin lang files. So, when I use
{{ trans("acme.demo::lang.string.example") }}, I'm expecting translated string value on the actual view.
But I encounter with "Unknown trans() function." exception instead. Testing "trans()" inside _Models_ or _Components_ is working without any issues.
My current October build is: 382.
trans is only available in PHP. Check out the underscore twig filter from the translate plugin. There are different ways to provide translations. Maybe read up on it first https://octobercms.com/plugin/rainlab-translate
As a side note, while you can add a reference to Lang::get() (which is effectively the implementation of trans() as a twig function / filter to accomplish what you desire, there is one issue with doing it that way. It's going to use your backend language settings on a frontend view; that's not going to have your intended results.
Like @jBOKA said, look into frontend translation via RainLab.Translate.
Thank you so much! It's more clear for me now :)
I'll try the twig filter of RainLab.Translate as fast as possible.
|trans is a filter in the system
{{ "acme.demo::lang.string.example"|trans }}
Most helpful comment
|transis a filter in the system