当前位置: 首页>>代码示例>>PHP>>正文


PHP eZContentObjectStateGroup::translationByLocale方法代码示例

本文整理汇总了PHP中eZContentObjectStateGroup::translationByLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectStateGroup::translationByLocale方法的具体用法?PHP eZContentObjectStateGroup::translationByLocale怎么用?PHP eZContentObjectStateGroup::translationByLocale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZContentObjectStateGroup的用法示例。


在下文中一共展示了eZContentObjectStateGroup::translationByLocale方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCreateWithvalidIdentifier

 /**
  * @dataProvider providerCreateWithValidIdentifier
  */
 public function testCreateWithvalidIdentifier($identifier)
 {
     $row = array('identifier' => $identifier);
     $stateGroup = new eZContentObjectStateGroup($row);
     $trans = $stateGroup->translationByLocale('eng-GB');
     $trans->setAttribute('name', $identifier);
     $messages = array();
     $this->assertTrue($stateGroup->isValid($messages), "Valid state group identifier '{$identifier}' was refused, " . var_export($messages, true));
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:12,代码来源:ezcontentobjectstategroup_test.php

示例2: array

$localeIDToUse = false;
// this script inserts English names, so preferably use an English locale
$preferredLocales = array('eng-GB', 'eng-US');
foreach ($preferredLocales as $preferredLocale) {
    if (in_array($preferredLocale, $locales)) {
        $localeToUse = $preferredLocale;
        break;
    }
}
// when none of the preferred locales are in use, then use the top priority language
if ($localeToUse === false) {
    $prioritizedLanguage = eZContentLanguage::topPriorityLanguage();
    $localeToUse = $prioritizedLanguage->attribute('locale');
}
$lockGroup = new eZContentObjectStateGroup(array('identifier' => 'ez_lock'));
$trans = $lockGroup->translationByLocale($localeToUse);
$trans->setAttribute('name', 'Lock');
$trans->setAttribute('description', 'Lock group');
$messages = array();
if ($lockGroup->isValid($messages)) {
    $cli->output('storing state group ez_lock');
    $lockGroup->store();
} else {
    eZDebug::writeDebug($messages);
    $db->rollback();
    $script->shutdown(2);
}
$notLockedState = $lockGroup->newState('not_locked');
$trans = $notLockedState->translationByLocale($localeToUse);
$trans->setAttribute('name', 'Not locked');
$trans->setAttribute('description', 'Not locked state');
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:31,代码来源:addlockstategroup.php


注:本文中的eZContentObjectStateGroup::translationByLocale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。