本文整理汇总了PHP中Zend_Translate_Adapter类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Translate_Adapter类的具体用法?PHP Zend_Translate_Adapter怎么用?PHP Zend_Translate_Adapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Translate_Adapter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _
/**
* Copy from \Zend_Translate_Adapter
*
* Translates the given string
* returns the translation
*
* @param string $text Translation string
* @param string|\Zend_Locale $locale (optional) Locale/Language to use, identical with locale
* identifier, @see \Zend_Locale for more information
* @return string
*/
public function _($text, $locale = null)
{
if (!$this->translateAdapter) {
$this->initTranslateable();
}
return $this->translateAdapter->_($text, $locale);
}
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:18,代码来源:JoinModel.php
示例2: setTranslator
/**
* Sets a translation Adapter for translation
*
* @param Zend_Translate|Zend_Translate_Adapter $translate
* @return Zend_View_Helper_HeadTitle
*/
public function setTranslator($translate)
{
if ($translate instanceof Zend_Translate_Adapter) {
$this->_translator = $translate;
} elseif ($translate instanceof Zend_Translate) {
$this->_translator = $translate->getAdapter();
} else {
require_once 'Zend/View/Exception.php';
throw new Zend_View_Exception("You must set an instance of Zend_Translate or Zend_Translate_Adapter");
}
return $this;
}
开发者ID:quangbt2005,项目名称:vhost-kis,代码行数:18,代码来源:HeadTitle.php
示例3: setTranslator
/**
* Sets a translation Adapter for translation
*
* @param Zend_Translate|Zend_Translate_Adapter $translate
* @return Zend_View_Helper_HeadTitle
*/
public function setTranslator($translate)
{
if ($translate instanceof Zend_Translate_Adapter) {
$this->_translator = $translate;
} elseif ($translate instanceof Zend_Translate) {
$this->_translator = $translate->getAdapter();
} else {
$e = new Zend_View_Exception("You must set an instance of Zend_Translate or Zend_Translate_Adapter");
$e->setView($this->view);
throw $e;
}
return $this;
}
开发者ID:bradley-holt,项目名称:zf2,代码行数:19,代码来源:HeadTitle.php
示例4: setTranslator
/**
* Set translator
*
* @param Zend_Translate|Zend_Translate_Adapter|null $translator
* @return Zend_View_Helper_FormElement
*/
public function setTranslator($translator = null)
{
if (null === $translator) {
$this->_translator = null;
} elseif ($translator instanceof Zend_Translate_Adapter) {
$this->_translator = $translator;
} elseif ($translator instanceof Zend_Translate) {
$this->_translator = $translator->getAdapter();
} else {
$e = new Zend_View_Exception('Invalid translator specified');
$e->setView($this->view);
throw $e;
}
return $this;
}
开发者ID:NerdGZ,项目名称:icingaweb2,代码行数:21,代码来源:FormElement.php
示例5: getTranslate
/**
* Retrieve translate object
*
* @throws Zend_Application_Resource_Exception if registry key was used
* already but is no instance of Zend_Translate
* @return Zend_Translate
*/
public function getTranslate()
{
if (null === $this->_translate) {
$this->buildLog();
// retrieve cache if requested
if (isset($this->_options['cacheEnabled']) && $this->_options['cacheEnabled']) {
// check for cachemanager in bootstrap
if (!$this->getBootstrap()->hasPluginResource('cachemanager')) {
throw new Zend_Application_Resource_Exception("You must configure the cachemanager with " . "the key {$this->getCacheKey()}");
}
// bootstrap the cachemanager and retrieve it
/** @var $cacheManager Zend_Cache_Manager */
$cacheManager = $this->getBootstrap()->bootstrap('cachemanager')->getResource('cachemanager');
// check for the given key
if (!$cacheManager->hasCache($this->getCacheKey())) {
throw new Zend_Application_Resource_Exception("You must configure the cachemanager with " . "the key {$this->getCacheKey()}");
}
// set cache for translator
Zend_Translate_Adapter::setCache($cacheManager->getCache($this->getCacheKey()));
}
// fetch translate object into local variable
$this->_translate = parent::getTranslate();
}
return $this->_translate;
}
开发者ID:JellyBellyDev,项目名称:zle,代码行数:32,代码来源:Translate.php
示例6: tearDown
protected function tearDown()
{
// restore static variables
if (isset($this->cache)) {
Zend_Translate_Adapter::setCache($this->cache);
unset($this->cache);
} else {
Zend_Translate_Adapter::removeCache();
}
// unset the registry
Zend_Registry::_unsetInstance();
}
开发者ID:JellyBellyDev,项目名称:zle,代码行数:12,代码来源:TranslateTest.php
示例7: setTranslator
/**
* Set translation object
*
* @param Zend_Translate|Zend_Translate_Adapter|null $translator
* @return Zend_Filter_Input
*/
public function setTranslator($translator = null)
{
if (null === $translator || $translator instanceof Zend_Translate_Adapter) {
$this->_translator = $translator;
} elseif ($translator instanceof Zend_Translate) {
$this->_translator = $translator->getAdapter();
} else {
require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception('Invalid translator specified');
}
return $this;
}
开发者ID:cljk,项目名称:kimai,代码行数:18,代码来源:Input.php
示例8: clearCache
/**
* Clears all set cache data
*
* @param string $tag Tag to clear when the default tag name is not used
* @return void
*/
public static function clearCache($tag = null)
{
Zend_Translate_Adapter::clearCache($tag);
}
开发者ID:JaroslavRamba,项目名称:ex-facebook-bundle,代码行数:10,代码来源:Translate.php
示例9: setDefaultTranslator
/**
* Set default translation object for all validate objects
*
* @param Zend_Translate|Zend_Translate_Adapter|null $translator
* @return void
*/
public static function setDefaultTranslator($translator = null)
{
if (null === $translator || $translator instanceof Zend_Translate_Adapter) {
self::$_defaultTranslator = $translator;
} elseif ($translator instanceof Zend_Translate) {
self::$_defaultTranslator = $translator->getAdapter();
} else {
#require_once 'Zend/Validate/Exception.php';
throw new Zend_Validate_Exception('Invalid translator specified');
}
}
开发者ID:par-orillonsoft,项目名称:Magento,代码行数:17,代码来源:Abstract.php
示例10: setTranslator
/**
* Sets a translation Adapter for translation
*
* @param Zend_Translate|Zend_Translate_Adapter $translate Instance of Zend_Translate
* @throws Zend_View_Exception When no or a false instance was set
* @return Zend_View_Helper_Translate
*/
public function setTranslator($translate)
{
if ($translate instanceof Zend_Translate_Adapter) {
$this->_translator = $translate;
} else {
if ($translate instanceof Zend_Translate) {
$this->_translator = $translate->getAdapter();
} else {
require_once 'Zend/View/Exception.php';
$e = new Zend_View_Exception('You must set an instance of Zend_Translate or Zend_Translate_Adapter');
$e->setView($this->view);
throw $e;
}
}
return $this;
}
开发者ID:fredcido,项目名称:cenbrap,代码行数:23,代码来源:Translate.php
示例11: setCache
/**
* Sets a cache for all Zend_Translate_Adapters
*
* @param Zend_Cache_Core $cache Cache to store to
*/
public static function setCache(Zend_Cache_Core $cache)
{
self::$_cache = $cache;
}
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:9,代码来源:Adapter.php
示例12: _
/**
* proxy for easy access to translations
*
* @param string $messageId Translation string
* @param string|\Zend_Locale $locale (optional) Locale/Language to use, identical with locale
* identifier, @see \Zend_Locale for more information
* @return string
*/
private function _($messageId, $locale = null)
{
if ($this->translate) {
return $this->translate->_($messageId, $locale);
}
return $messageId;
}
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:15,代码来源:TemplateModel.php
示例13: afterRegistry
public function afterRegistry()
{
parent::afterRegistry();
$this->setIfExists('gof_form_id', 'label', $this->translate->_('FormID'));
$this->setIfExists('gof_form_version', 'label', $this->translate->_('Version'));
$this->setIfExists('gof_form_title', 'label', $this->translate->_('Name'));
$this->setIfExists('gof_form_active', 'label', $this->translate->_('Active'), 'elementClass', 'checkbox');
}
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:8,代码来源:OpenRosaFormModel.php
示例14: testDiffReadableBeforeAndAfterLocalised
public function testDiffReadableBeforeAndAfterLocalised()
{
$this->translate->setLocale('nl');
$this->object = new \MUtil_Date('2010-05-13 12:00:00');
$testDate = new \MUtil_Date('2010-05-13 12:00:10');
$this->assertEquals('10 seconden geleden', $this->object->diffReadable($testDate, $this->translate));
$testDate = new \MUtil_Date('2010-05-13 11:59:50');
$this->assertEquals('over 10 seconden', $this->object->diffReadable($testDate, $this->translate));
$testDate = new \MUtil_Date('2010-05-13 12:00:00');
$this->assertEquals('over 0 seconden', $this->object->diffReadable($testDate, $this->translate));
}
开发者ID:GemsTracker,项目名称:MUtil,代码行数:11,代码来源:DateTest.php
示例15: _addElementPerson
private function _addElementPerson()
{
$translate = Zend_Registry::get("Zend_Translate");
$url = new Zend_View_Helper_Url();
$urlSearch = $url->url(array('module' => 'persons', 'controller' => 'person', 'action' => 'search-form'), null, true);
$urlNew = $url->url(array('module' => 'persons', 'controller' => 'person', 'action' => 'create'), null, true);
$append = '';
if ($this->_action == self::ACTION_ADD) {
$append .= '<a id="btnPersonSearch" href="' . $urlSearch . '" ' . ' rel="colorbox-search" search-return-id="id" search-return-value="person_name">' . '<i class="icon-search" rel="tooltip" data-original-title="' . $this->translate->_("Search person") . '"></i>' . '</a>';
}
$this->addElement('text', 'person_name', array('label' => 'Person', 'value' => $this->_model ? $this->_model->getPerson()->getName() : '', 'dimension' => 6, 'disabled' => true, 'placeholder' => $translate->_('Use the links aside to search a person or create a new one'), 'append' => $append . ' | ' . '<a class="hide" id="btnPersonDetails" href="#" rel="colorbox-details">' . $this->translate->_("Details") . '</a>' . ' | ' . '<a class="hide" id="btnPersonCreate" href="' . $urlNew . '" rel="colorbox">' . '<i class="icon-plus-sign" rel="tooltip" data-original-title="' . $this->translate->_("Add new") . ' ' . $this->translate->_("person") . '"></i>' . '</a>'));
}
开发者ID:brunopbaffonso,项目名称:ongonline,代码行数:12,代码来源:Employee.php
示例16: __construct
/**
* Generates the adapter
*
* @param string $data Translation data
* @param string|Zend_Locale $locale OPTIONAL Locale/Language to set, identical with locale identifier,
* see Zend_Locale for more information
* @param array $options Options for this adapter
*/
public function __construct($data, $locale = null, array $options = array())
{
$this->_options['delimiter'] = ";";
$this->_options['length'] = 0;
$this->_options['enclosure'] = '"';
parent::__construct($data, $locale, $options);
}
开发者ID:openbizx,项目名称:openbizx-cubix,代码行数:15,代码来源:Csv.php
示例17: __construct
/**
* Generates the adapter
*
* @param array $db The DB connection
* @param string|Zend_Locale $locale OPTIONAL Locale/Language to set, identical with locale identifier,
* see Zend_Locale for more information
* @param array $options OPTIONAL Options to set
*/
public function __construct($db, $locale = null, array $options = array())
{
// If $db is null: nothing to do.
if ($db == null) {
return;
}
// Keep the db reference for possible use
$this->db = $db;
// Check whether the view system is PHPLIB. In yes we
// add all the translations as entities in the view object
// Get the utilitary objects from the registry
$registry = Zend_registry::getInstance();
$zmax_context = $registry->get("zmax_context");
$config = $zmax_context->config;
// By default we take the zmax context view, unless it is explicitly given
if (isset($options['view'])) {
$this->phplib_view = $options['view'];
} else {
if ($config->view->zmax_view_system == "phplib") {
$this->phplib_view = $zmax_context->view;
}
}
// Now call the parent constructor
// Adding this option is necessary starting with Zend 1.6, to prevent
// an ugly message
$options['disableNotices'] = 'true';
parent::__construct($db, $locale, $options);
}
开发者ID:camilorivera,项目名称:INNOVARE,代码行数:36,代码来源:Db.php
示例18: __construct
/**
* Generates the adapter
*
* @param array|Zend_Config $options Translation content
*/
public function __construct($options = array())
{
$this->_options['delimiter'] = ";";
$this->_options['length'] = 0;
$this->_options['enclosure'] = '"';
if ($options instanceof Zend_Config) {
$options = $options->toArray();
} else {
if (func_num_args() > 1) {
$args = func_get_args();
$options = array();
$options['content'] = array_shift($args);
if (!empty($args)) {
$options['locale'] = array_shift($args);
}
if (!empty($args)) {
$opt = array_shift($args);
$options = array_merge($opt, $options);
}
} else {
if (!is_array($options)) {
$options = array('content' => $options);
}
}
}
parent::__construct($options);
}
开发者ID:Nerutiz,项目名称:trades,代码行数:32,代码来源:Csv.php
示例19: __construct
public function __construct($locale)
{
if (!$locale instanceof Zend_Locale) {
$locale = new Zend_Locale($locale);
}
$locale = (string) $locale;
parent::__construct(array("locale" => $locale, "content" => array("__pimcore_dummy" => "only_a_dummy")));
}
开发者ID:ngocanh,项目名称:pimcore,代码行数:8,代码来源:Translate.php
示例20: translate
/**
* Translates the given string
* returns the translation
*
* @see Zend_Locale
* @param string|array $messageId Translation string, or Array for plural translations
* @param string|Zend_Locale $locale (optional) Locale/Language to use, identical with
* locale identifier, @see Zend_Locale for more information
* @param string $section
* @return string
*/
public function translate($messageId, $locale = null, $section = 'global')
{
$this->_logSection = $section;
$translated = parent::translate($messageId, $locale);
if ($translated == '') {
return $messageId;
}
return $translated;
}
开发者ID:bokultis,项目名称:kardiomedika,代码行数:20,代码来源:Db.php
注:本文中的Zend_Translate_Adapter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论