I am trying to add a language file of zend form errors to my language file, which can be found in
ZendFramework-1.11.2.zip\ZendFramework-1.11.2\resources\languages
to have localized form validators. This blog http://www.thomasweidner.com/flatpress/2010/03/25/working-with-multiple-translation-sources/comments/ explains what I'm trying to do, but it fails :( it only translates from mine .ini file, .php not included Here is what I did:
this is my application.ini application
resources.translate.adapter = "ini"
resources.translate.default.locale = "it_IT"
resources.translate.default.locale = "en_US"
resources.translate.default.file = APPLICATION_PATH "/lang/source-it.ini"
resources.translate.translation.en = APPLICATION_PATH "/lang/source-en.ini"
resources.translate.data = APPLICATION_PATH "/lang"
and then I have it
<?php
class Gestionale_Application_Resource_Translate extends Zend_Application_Resource_ResourceAbstract
{
public function init ()
{
$options = $this->getOptions();
$adapter = $options['adapter'];
$defaultTranslation = $options['default']['file'];
$defaultLocale = $options['default']['locale'];
$translate = new Zend_Translate($adapter, $defaultTranslation, $defaultLocale);
$translation_addme = new Zend_Translate(
'array',
APPLICATION_PATH."/resources/languages/it/Zend_Validate.php"
'it',
array('scan' => Zend_Translate::LOCALE_DIRECTORY)
);
$translate->addTranslation($translation_addme);
foreach ($options['translation'] as $locale => $translation) {
$translate->addTranslation($translation, $locale);
}
Zend_Registry::set('Zend_Translate', $translate);
return $translate;
}
}
and this is my catalog
c:\www\www\gestionale\application>dir /w /aD
Il volume nell'unitΓ C Γ¨ OS
Numero di serie del volume: 6A5E-FD9B
Directory di c:\www\www\gestionale\application
[.] [..] [.svn] [configs] [controllers]
[forms] [lang] [layouts] [models] [resources]
[views]
0 File 0 byte
11 Directory 447.780.282.368 byte disponibili
source
share