Assigning language values to a template can be a boring and repetitive process, as always on Tequila, we want to work less.
Your page takes the language resources from:
A global language file
A page specific language file
All values common to an application should be stored in this file, i.e.:
Ok button,
cancel button,
general error messages
Follow the same naming as the view and contain language values for only this page
Structure of the language file
The language file is created as a Multidimensional array to allow values to be processed as groups,
i.e.
$lang['label']['lbl_headertext'] = 'lbl_headertext';
In this case ‘label’ is the group, which allow the group to be processed together
Group assignment
There are many ways of doing this, if you need to replace 20 different tags in the same section of a document, simply group them as mentioned before, i.e. ‘label’ or ‘results’ and then assign them in one single instructions
$this->setlang(‘label’);
You can still assign single values, or use the traditional assign, the value of the setlang function is:
Avoid calling global for $lang
Process one or many values together
Reduce the amount of code and time to create pages
Single value assignment
You can use the same function with 2 parameters:
$this->setlang(‘label’, ‘lbl_headertext);
Or use the template functions instead
Global $lang; // Get access to the language resources
$this->template->assign(‘placeholder’, $lang[‘label’][‘lbl_headertext’]);
Strategies assignment
Strategies follow a similar pattern, you can call the function addlang, check Using strategies to view the whole functionality.
public function addlang($key, $subkey=null, $scope='block')