i don't figure out a way to extract automaticaly string to be translated in files.
For instance, you've got in your layout and views some echo $this->translate('my_string');
and I want to created the files 'en_US.php', 'fr_FR.php', 'es_ES.php' with the comparative array :
<?php return array('my_string' => 'translation of my string'); ?>
Is it possible ?
Thanks.
Look at the Zend_Translate adapters and choose one. I warmly recommend the gettext adapter.
Here is how to implement i18n in your Zend Framework application:
- Setup a translation adapter during Bootstrap
- Store the adapter object in the registry with Zend_Registry::set('Zend_Translate', $translate);
- Wrap all text in the equivalent of $translate->translate('This is translatable text');
- Install 'gettext' on your development machine.
- Install and setup poEdit. poEdit will scan your application and find all translatable strings. It will then store them in a .po file, which you can edit and multiply for other languages.
- When you're done, save it and poEdit stores creates the .mo files. The Zend_Translate gettext adapter needs those.