Difference between revisions of "How to translate options in additional fields and text added with customizations"

From aMember Pro Documentation
Jump to: navigation, search
Line 1: Line 1:
Create /amember/application/configs/site.php with this code:  
+
Add this code to [[site.php file]]:
 
+
 
<source>
 
<source>
 
 
//set up array of translataions
 
//set up array of translataions
 
$translations_ru = array(
 
$translations_ru = array(
Line 9: Line 7:
 
);
 
);
  
//get global translate object
+
//retrieve global translate object
 
$tr = Zend_Registry::get('Zend_Translate');
 
$tr = Zend_Registry::get('Zend_Translate');
$locale = $tr->getLocale(); //save current active locale
+
$locale = $tr->getLocale(); //save current active locale to temporary variable
  
 
//add your new translations
 
//add your new translations

Revision as of 03:38, 9 August 2013

Add this code to site.php file:

//set up array of translataions
$translations_ru = array(
    'one' => 'Один',
    'two' => 'Два'
);
 
//retrieve global translate object
$tr = Zend_Registry::get('Zend_Translate');
$locale = $tr->getLocale(); //save current active locale to temporary variable
 
//add your new translations
$tr->addTranslation(array(
    'adapter' => 'array',
    'content' => $translations_ru,
    'locale' => 'ru_RU',
));
 
//restore locale to previous state
$tr->setLocale($locale);