API Documentation

View/Helper/Translate.php

Zend Framework

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-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_View  
subpackage
Helper  
version
$Id: Translate.php 23775 2011-03-01 17:25:24Z ralph $  

\Zend_View_Helper_Translate

Translation view helper

Extends from
\Zend_View_Helper_Abstract
category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_View  
subpackage
Helper  

Properties

Propertyprotected\Zend_Translate_Adapter  $_translator= ''

Translation object

Methods

methodpublic__construct( \Zend_Translate|\Zend_Translate_Adapter $translate = null ) : void

Constructor for manually handling

Parameters
Name Type Description
$translate \Zend_Translate|\Zend_Translate_Adapter Instance of Zend_Translate
methodpublicdirect( ) : void

Strategy pattern: currently unutilized

Inherited from: \Zend_View_Helper_Abstract::direct()
methodpublicgetLocale( ) : string|\Zend_Locale

Returns the set locale for translations

Returns
Type Description
string\Zend_Locale
Throws
Exception Description
\Zend_View_Exception When no Zend_Translate instance was set
methodpublicgetTranslator( ) : \Zend_Translate_Adapter|null

Retrieve translation object

Returns
Type Description
\Zend_Translate_Adapternull
methodpublicsetLocale( string|\Zend_Locale $locale = null ) : \Zend_View_Helper_Translate

Set's an new locale for all further translations

Parameters
Name Type Description
$locale string|\Zend_Locale New locale to set
Returns
Type Description
\Zend_View_Helper_Translate
Throws
Exception Description
\Zend_View_Exception When no Zend_Translate instance was set
methodpublicsetTranslator( \Zend_Translate|\Zend_Translate_Adapter $translate ) : \Zend_View_Helper_Translate

Sets a translation Adapter for translation

Parameters
Name Type Description
$translate \Zend_Translate|\Zend_Translate_Adapter Instance of Zend_Translate
Returns
Type Description
\Zend_View_Helper_Translate
Throws
Exception Description
\Zend_View_Exception When no or a false instance was set
methodpublicsetView( \Zend_View_Interface $view ) : \Zend_View_Helper_Abstract

Set the View object

Inherited from: \Zend_View_Helper_Abstract::setView()
Parameters
Name Type Description
$view \Zend_View_Interface
Returns
Type Description
\Zend_View_Helper_Abstract
methodpublictranslate( string $messageid = null ) : string|\Zend_View_Helper_Translate

Translate 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);

Parameters
Name Type Description
$messageid string Id of the message to be translated
Returns
Type Description
string\Zend_View_Helper_Translate Translated message
Documentation was generated by DocBlox 0.13.3.