Closed ghost closed 12 years ago
@booradleys: The skeletons are not really meant to be full-fledged examples, but rather bare-bones starting points for your own code. (ie, something a CLI tool might create once we have one: zf create project ZendSkeletonApplication
). For the examples you're looking for, you should check out modules like ZfcUser, etc. (Yes, we plan on adding translations to Zfcuser).
Hi Evan, Yes each time i need help, i'm looking for into zfcUser ;-) You did a real great job !
I'm looking how to implement I18n/Translator (into each Module.php of each module ?).
I'm using a wrong way (Registry) to pass data from I18n/Translator/Translator to I18n/View/Helper/Translate).
But i suppose i should use service manager but i don't know how.
{code} public function initTranslator(Event $e) { $app = $e->getParam('application'); $locator = $app->getServiceManager(); $view = $locator->get('Zend\View\View'); $renderer = $locator->get('Zend\View\Renderer\PhpRenderer');
$module = 'application';
$lang = 'fr';
$originalLocale = Locale::getDefault();
Locale::setDefault($lang);
$service = array(
'name' => 'phpini',
'class' => new \Mix\I18n\Translator\Loader\PhpIni(),
'directory' => "module/".$module."/i18n/".$lang,
'filename' => 'common.ini'
);
$options = array('locale' => $lang);
$translator = \Zend\I18n\Translator\Translator::factory($options);
$translator->getPluginManager()->setService($service['name'], $service['class']);
$translator->addTranslationPattern($service['name'], $service['directory'], $service['filename']);
$renderer->plugin('translate')->setTranslator($translator);
}
{code}
But when using i got : Translator has not been set
@booradleys See PR #1743. Once that's merged, it should simplify things quite a bit.
Thank you Evan. I'm going to wait for this merge (in beta5)
Hi there, I would be great that this module (or ZendSkeletonModule) show an example to:
David