View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Proposal Zone Template}



2.0 - 13 January 2008: Finished implementation
1.1 - 3 November 2007: Small adoptions
1.0 - 1 November 2007: Initial revision

Zend_View_Helper_Translate is an view helper for having easy and simple integration of Zend_Translate within the view.

* [Zend_Translate]

Requires a Zend_Translate instance to operate. It will add the possibility for users to translate messages from within the view without much coding.

* Zend_Translate

Translates messages through Zend_Translate. Can accept parameters to be integrated.

* Milestone 1: \[DONE\] [Proposal finished|]
* Milestone 2: \[DONE\] Class integration
* Milestone 3: \[DONE\] Unit tests
* Milestone 4: \[DONE\] Documentation

* Zend_View_Helper_Translate

// simple translation from within the view
$this->translate('Translate this');

// translation with one parameter from within the view
$this->translate('Translate this %1\$s', 'again');

// translation with multiple parameters from within the view
$this->translate('Translate this %1\$s with %2\$s and %3\$s %4\%s', 'again', 'one', 'another', 10);

// translation with multiple parameters from within the view
$this->translate('Translate this %1\$s with %2\$s and %3\$s %4\%s', array('again', 'one', 'another', 10));

// throws Zend_Translate_Exception !!!
class Zend_View_Helper_Translate {

private $_translation; // Zend_Translate_Adapter

* Constructor for Zend_View_Helper_Translate
* @param $translation Zend_Translate_Adapter for translation
public function __construct(Zend_Translate_Adapter $translation);

* Translates the given messageid
* Accepts multiple additional parameters, see use cases
* @param string $messageid The messageid to translate
* @throws Zend_Translate_Exception
* @returns string Translation
public function translate($messageid);