當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Translation::getTranslation方法代碼示例

本文整理匯總了PHP中Translation::getTranslation方法的典型用法代碼示例。如果您正苦於以下問題:PHP Translation::getTranslation方法的具體用法?PHP Translation::getTranslation怎麽用?PHP Translation::getTranslation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Translation的用法示例。


在下文中一共展示了Translation::getTranslation方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: mergeWith

 /**
  * Merges this translation with other translation
  *
  * @param Translation  $translation The translation to merge with
  * @param integer|null $method      One or various Translations::MERGE_* constants to define how to merge the translations
  */
 public function mergeWith(Translation $translation, $method = null)
 {
     if ($method === null) {
         $method = Translations::$mergeDefault;
     }
     if (!$this->hasTranslation()) {
         $this->setTranslation($translation->getTranslation());
     }
     if ($method & Translations::MERGE_PLURAL && !$this->hasPlural()) {
         $this->setPlural($translation->getPlural());
     }
     if ($this->hasPlural() && !$this->hasPluralTranslation() && $translation->hasPluralTranslation()) {
         $this->pluralTranslation = $translation->getPluralTranslation();
     }
     if ($method & Translations::MERGE_REFERENCES) {
         foreach ($translation->getReferences() as $reference) {
             $this->addReference($reference[0], $reference[1]);
         }
     }
     if ($method & Translations::MERGE_COMMENTS) {
         $this->comments = array_values(array_unique(array_merge($translation->getComments(), $this->comments)));
         $this->extractedComments = array_values(array_unique(array_merge($translation->getExtractedComments(), $this->extractedComments)));
         $this->flags = array_values(array_unique(array_merge($translation->getFlags(), $this->flags)));
     }
 }
開發者ID:yakamoz-fang,項目名稱:concrete,代碼行數:31,代碼來源:Translation.php

示例2: mergeTranslation

 /**
  * Merge the translations of two translations.
  * 
  * @param Translation $from
  * @param Translation $to
  * @param int         $options
  */
 public static function mergeTranslation(Translation $from, Translation $to, $options = self::DEFAULTS)
 {
     $override = (bool) ($options & self::TRANSLATION_OVERRIDE);
     if (!$to->hasTranslation() || $from->hasTranslation() && $override) {
         $to->setTranslation($from->getTranslation());
     }
     if (!$to->hasPlural() || $from->hasPlural() && $override) {
         $to->setPlural($from->getPlural());
     }
     if (!$to->hasPluralTranslations() || $from->hasPluralTranslations() && $override) {
         $to->setPluralTranslations($from->getPluralTranslations());
     }
 }
開發者ID:parkerj,項目名稱:eduTrac-SIS,代碼行數:20,代碼來源:Merge.php

示例3: getFirstDifferentTranslation

 /**
  * @param Translation $otherTranslation
  * @return TranslationRow|null
  */
 public function getFirstDifferentTranslation(Translation $otherTranslation)
 {
     /** @var TranslationRow $translation */
     foreach ($this->getTranslations() as $translation) {
         $oldTranslation = $otherTranslation->getTranslation($translation->getIso2());
         if ($oldTranslation === null || $translation->getName() !== $oldTranslation->getName()) {
             return $translation;
         }
     }
     return null;
 }
開發者ID:evaneos,項目名稱:berthe,代碼行數:15,代碼來源:Translation.php


注:本文中的Translation::getTranslation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。