0

I have the following setup in my application Bootstrap.php

 protected function _initTranslation()
{
    $langPath = APPLICATION_PATH.'/languages/';
    $translate = new Zend_Translate_Adapter_Gettext($langPath . 'site-ro.mo', 'ro');
    $translate = new Zend_Translate_Adapter_Gettext($langPath . 'site-en.mo', 'en');
    $translate->setLocale('en');
    Zend_Registry::set('Zend_Translate', $translate);
}

and in my add.phtml file I have it like this

 <label for="page_title" class="sr-only"><?= $this->translate("Page title") ?></label>

I know this works only if i have the setLocale to 'en' and if there exists an translation. But i don't know how to set for multiple translations and also not to throw errors if the .po file doesn't have a translation.

Tudor Ravoiu
  • 2,130
  • 8
  • 35
  • 56

1 Answers1

0

look at here:
Additional features for translation

You can always change your language in controller by these code :

    $translate = Zend_Registry::get('Zend_Translate');
    $translate->setLocale('ro');

after that your locale will be changed.

3ehrang
  • 619
  • 1
  • 7
  • 22