Wallogit.com
2017 © Pedro Peláez
Language switcher add-on for atk4 with yaml file support. Add-on requires ATK version 4.3 or higher., (*1)
Add object to sandbox_addons.json and set such properties:, (*2)
Configure add-on in config.php:, (*3)
All config settings must be placed into array :, (*4)
$config['rvadym']['languages'] = array(). If there is no option, it would set to default values., (*5)
You may use such options:, (*6)
Place the line into frontend class init to add switcher :, (*7)
$this->languages->addLangSwitcher($this);
You can also change look of switcher., (*8)
Extend your own switcher View from rvadym\languages\View_LanguageSwitcher and change template and method showSwitcher() . To use custom view for switcher you must set option in config.php or set second parameter of addLangSwitcher function (more priority)., (*9)
Value of View instances (View, H1, P etc.) would be translated automatically after set., (*10)
To translate value of wrapped elements like Text use "api->_('value')" or system message like confirmation:, (*11)
$this->add('Text')->set($this->api->_('some value')); //for text value
$button->js('click')->univ()->confirm($this->api->_('Some process will be started. Continue?'))); //for confirmation
You can store translations in database or in yml files (use config 'store_type')., (*12)
To store in database you need to follow instructions above:, (*13)
It would translate value of column 'value' to the value of chosen language column (like 'en')., (*14)
To customize model, extend it from Model_Translation., (*15)
Create page and extend it from rvadym\languages\page_langadmin to have a possibility to change translations, stored in database. Every tab on this page would be translated if it's value is added to translations., (*16)
//TODO: - make possible to select languages to be synchronized in langadmin page - make possible to use atk4-addons/dynamic_model to set language fields automatically during installation. - make UI view to use ui_name, (*17)