This is the solution I am using:
Code for Plugin.php
// BEGIN: Translate
$validLang = $this->getRequest()->getParam('lang');
$translate = new Zend_Translate('csv', 'data/lang/en.csv', 'en');
$translate->addTranslation('data/lang/ro.csv', 'ro');
if($validLang)
{
Zend_Registry::set('lang', $validLang);
$translate->setLocale($validLang);
}
else
{
Zend_Registry::set('lang', 'en');
$translate->setLocale('en');
}
Zend_Registry::set('translate', $translate);
// END: Translate
Code for en.csv
front_user_menu-wall;Wall
Code for ro.csv
front_user_menu-wall;Perete
Code for any Zend View file
echo Zend_Registry::get('translate')->_('front_user_menu-wall');
And some explanations:
In folder data/lang I have 2 .csv translation files. The structure is self explanatory, the semicolon (;) separates the variable name (front_user_menu-wall) from the variable value (Wall). Each variable must be placed on a new line and you can have line comments inside (ex: #this is a comment). The ro.csv file is the romanian translation file, it has the same structure, but obviously different values for the variables.
Inside Plugin.php you have
$validLang = $this->getRequest()->getParam('lang);
Zend equivalent for
$validLang = $_GET['lang'];
On the next 2 lines of code we instantiate a new Zend_Translate class using the 2 translation .csv files. Next we check if $validLang is not empty, if it's not them we set the Zend_Registry lang variable (Zend_Registry is similar with $_SESSION) with the translation file. If $validLang is empty then we default the translation to english.
If you did all the steps above, you can now echo
Zend_Registry::get('translate')->_('front_user_menu-wall');
to get the english or romanian translation.