View/Helper/Translate.php
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_View
- Subpackage
- Helper
- Version
- $Id: Translate.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_View_Helper_Translate
- Parent(s)
- \Zend_View_Helper_Abstract
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties

\Zend_View_Interface $view = nullnullDetails- Type
- \Zend_View_Interface
- Inherited_from
- \Zend_View_Helper_Abstract::$$view
Methods

__construct(\Zend_Translate | \Zend_Translate_Adapter $translate = null) : voidConstructor for manually handling
| Name | Type | Description |
|---|---|---|
| $translate | \Zend_Translate | \Zend_Translate_Adapter | Instance of Zend_Translate |

getLocale() : string | \Zend_LocaleReturns the set locale for translations
| Type | Description |
|---|---|
| string | \Zend_Locale |
| Exception | Description |
|---|---|
| \Zend_View_Exception | When no Zend_Translate instance was set |

getTranslator() : \Zend_Translate_Adapter | nullRetrieve translation object
| Type | Description |
|---|---|
| \Zend_Translate_Adapter | null |

setLocale(string | \Zend_Locale $locale = null) : \Zend_View_Helper_TranslateSet's an new locale for all further translations
| Name | Type | Description |
|---|---|---|
| $locale | string | \Zend_Locale | New locale to set |
| Type | Description |
|---|---|
| \Zend_View_Helper_Translate |
| Exception | Description |
|---|---|
| \Zend_View_Exception | When no Zend_Translate instance was set |

setTranslator(\Zend_Translate | \Zend_Translate_Adapter $translate) : \Zend_View_Helper_TranslateSets a translation Adapter for translation
| Name | Type | Description |
|---|---|---|
| $translate | \Zend_Translate | \Zend_Translate_Adapter | Instance of Zend_Translate |
| Type | Description |
|---|---|
| \Zend_View_Helper_Translate |
| Exception | Description |
|---|---|
| \Zend_View_Exception | When no or a false instance was set |

setView(\Zend_View_Interface $view) : \Zend_View_Helper_Abstract| Name | Type | Description |
|---|---|---|
| $view | \Zend_View_Interface |
| Type | Description |
|---|---|
| \Zend_View_Helper_Abstract |

translate(string $messageid = null) : string | \Zend_View_Helper_TranslateTranslate a message You can give multiple params or an array of params.
If you want to output another locale just set it as last single parameter Example 1: translate('%1\$s + %2\$s', $value1, $value2, $locale); Example 2: translate('%1\$s + %2\$s', array($value1, $value2), $locale);
| Name | Type | Description |
|---|---|---|
| $messageid | string | Id of the message to be translated |
| Type | Description |
|---|---|
| string | \Zend_View_Helper_Translate | Translated message |