First of all, I'd suggest to use complete phrases as the basis for your translation. With words you always have the problem that languages are not consistent when it comes to sentence structure.
Then you have to choose one of the available Zend_Transalate adapters: Array, Csv, Gettext, Ini, Tbx, Tmx, Qt, Xliff or XmlTm. Most of them are adapters to industry standards for storing translation information, so it probably would suffice if you chose Array, Csv or Ini for the beginning and for the ease of use. Please see 49.2.1. How to decide which translation adapter to use in the Zend Framework manual.
// setup your translation
$translate = new Zend_Translate('csv', '/my/path/source-de.csv', 'de');
$translate->addTranslation('/my/path/source-en.csv', 'en');
// add the translation adapter to the registry
Zend_Registry::set('Zend_Translate', $translate);
As there is a Zend_View_Helper_Translate
that access the standardized Zend_Registry
entry Zend_Translate
as the default translation source, you can use the following in your views:
[...]
<title><?php echo this->translate('Title'); ?></title>
[...]
<p>You can also do <?php echo $this->translate('Hello %1$s', $this->userName); ?></p>
[...]
Please note that this only is a short introduction into Zend_Translate
and by no means a complete presentation of the functionality provided by this component. For example there is a lot to be said about determining the locale the translation adapter will use.
I'd suggest you read the following in the Zend Framework manual, because localization can be a complex issue and Zend_Translate
can not be described entirely in here: