I created a page with constants to make a internacionalization
app/var/languages/en.php
(pt.php, es.php, fr.php...)
define('text_1', 'First');
define('text_2', 'Second');
//...
app/views/index/index.volt
{{ constant('text_1') }} //Display First
{{ constant('text_2') }} //Display Second
This approach works if i set the constants directly in controller but nor working if i try loaded the page en.php in the ControllerBase with require, not displays nothing. How i can load the translates pages every time which site is loaded
Do something like this in BaseController or service.php, i don't know
$lang = $this->dispatcher->getParam("lang");
if(!empty($lang))
{
require ROOT_PATH . 'app/var/languages/' . $lang . '.php';
}
else
require ROOT_PATH . 'app/var/languages/en.php';