I'm having different languages on my web application.
Now i would like to do write: About us in the mustache file.
but then depending on the language the user has chosen (logic in the view/controller), it should display the correct translation for About us.
The translation would be something i have stored for exactly the words: About us
I have seen another webapplication that does it this way:
{{#lang}}About us{{/lang}}
But I dont understand how this is working? How can the lang() method in the view model grab the data within #lang, "About us" - and then replace it with something else, if exists.
(the procedure grabbing the translation from database or file, that matches "About us" do i not need to know)
I didn't know it is possible to reverse like that, sending the "About us" to the lang() method in view model?
Hope someone can explain and with example. Thanks
This is what I tried, in my view:
public function lang($input)
{
return "test" . $input;
}
But this does not work. (No argument passed to lang() )
I am using Mustache (Kostache) together with PHP in a MVC framework (kohana)