Using language files
Introduction
You may have previously read about config variables or language variables in the OFW template syntax documentation. Below is a more detailed explanation of how you can use language files and language variables to localize your templates and system messages.
Quick rundown
Language files are a way to store locale-based information in structured key/value pairs. The format is standard ini. Here’s how to create them:
- Create files for all your supported locales, for example
/lang/user.en_US.lang.ini - Add all the sections and variables to the ini file
- Where needed, load the language file:
$this->zajlib->lang->load('user');. The file of the current locale will be loaded automatically. You can also load language files in templates:{% lang 'user' %} - You can also load a specific section with
$this->zajlib->lang->load('user', 'my_section');or{% lang 'user' 'my_section' %} - Then just use the variables:
{{#a_language_variable#}}in a template or
$this->zajlib->lang->variable->a_language_variablein php code