View/Helper/Translate.php

Show: PublicProtectedPrivateinherited
Table of Contents
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-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_View  
Subpackage
Helper  
Version
$Id$  

\Zend_View_Helper_Translate

Package: Zend_View\Helper
Translation view helper
Parent(s)
\Zend_View_Helper_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotected\Zend_Translate_Adapter $_translator
Translation object

Methods

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

Constructor for manually handling

Parameters
NameTypeDescription
$translate\Zend_Translate | \Zend_Translate_Adapter

Instance of Zend_Translate

methodpublicgetLocale() : string | \Zend_Locale

Returns the set locale for translations

Returns
TypeDescription
string | \Zend_Locale
Throws
ExceptionDescription
\Zend_View_ExceptionWhen no Zend_Translate instance was set
methodpublicgetTranslator() : \Zend_Translate_Adapter | null

Retrieve translation object

Returns
TypeDescription
\Zend_Translate_Adapter | null
methodpublicsetLocale(string | \Zend_Locale $locale = null) : \Zend_View_Helper_Translate

Set's an new locale for all further translations

Parameters
NameTypeDescription
$localestring | \Zend_Locale

New locale to set

Returns
TypeDescription
\Zend_View_Helper_Translate
Throws
ExceptionDescription
\Zend_View_ExceptionWhen no Zend_Translate instance was set
methodpublicsetTranslator(\Zend_Translate | \Zend_Translate_Adapter $translate) : \Zend_View_Helper_Translate

Sets a translation Adapter for translation

Parameters
NameTypeDescription
$translate\Zend_Translate | \Zend_Translate_Adapter

Instance of Zend_Translate

Returns
TypeDescription
\Zend_View_Helper_Translate
Throws
ExceptionDescription
\Zend_View_ExceptionWhen no or a false instance was set
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
NameTypeDescription
$messageidstring

Id of the message to be translated

Returns
TypeDescription
string | \Zend_View_Helper_TranslateTranslated message
Documentation was generated by phpDocumentor 2.2.0 .