Hi All,

Apologies for the 'newbie' question here, this is my first use case of Zend_Translate so just want to check that I am invoking it correctly, in my bootstrap class I have this (a combination of some manual examples):

protected function _initLanguages()
    {
        $locale = new Zend_Locale();
                Zend_Registry::set('Zend_Locale', $locale);

                $defaultlanguage = 'en';
                
                $translate = new Zend_Translate('csv', 
APPLICATION_PATH.'/languages');
            if (!$translate->isAvailable($locale->getLanguage())) {
                    $translate->setLocale($defaultlanguage);
                }
        
                Zend_Registry::set('Zend_Translate',$translate);
    }

Bascially I have a directory /languages under /application which contains en.csv, fr.csv

All of the labels displayed on the site forms (All extended Zend_Form objects) are simply 'Form1_FieldName' and there is an appropriate entry in the csv file to tie this up with the language of the user (and should fall back to english if there is not a translation matching the users own language)

Is this the correct approach, any pointers/tips would be greatly appreciated.

Thanks,

Nick

Reply via email to