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


PHP Translation::addExtractedComment方法代碼示例

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


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

示例1: mergeExtractedComments

 /**
  * Merge the extracted comments of two translations.
  * 
  * @param Translation $from
  * @param Translation $to
  * @param int         $options
  */
 public static function mergeExtractedComments(Translation $from, Translation $to, $options = self::DEFAULTS)
 {
     if ($options & self::EXTRACTED_COMMENTS_THEIRS) {
         $to->deleteExtractedComments();
     }
     if (!($options & self::EXTRACTED_COMMENTS_OURS)) {
         foreach ($from->getExtractedComments() as $comment) {
             $to->addExtractedComment($comment);
         }
     }
 }
開發者ID:parkerj,項目名稱:eduTrac-SIS,代碼行數:18,代碼來源:Merge.php

示例2: getByRow

 public static function getByRow($row)
 {
     $result = null;
     if ($row && $row['mtID']) {
         $result = new Translation($row['context'], $row['msgid'], $row['msgidPlural']);
         $result->mtID = $row['mtID'];
         $result->mtSectionID = $row['mtSectionID'];
         $result->setTranslation($row['msgstr']);
         if (isset($row['comments'])) {
             foreach (explode("\n", $row['comments']) as $comment) {
                 $result->addExtractedComment($comment);
             }
         }
         if ($result->hasPlural() && isset($row['msgstrPlurals'])) {
             foreach (explode("", $row['msgstrPlurals']) as $pluralIndex => $plural) {
                 $result->setPluralTranslation($plural, $pluralIndex);
             }
         }
         if (isset($row['reference'])) {
             foreach (explode("\n", $row['reference']) as $reference) {
                 if ($reference !== '') {
                     $line = null;
                     $p = strrpos($reference, ':');
                     if ($p) {
                         $s = substr($reference, $p + 1);
                         if (preg_match('/^\\d+$/', $s)) {
                             $line = (int) $s;
                             $reference = substr($reference, 0, $p);
                         }
                     }
                     $result->addReference($reference, $line);
                 }
             }
         }
         if (isset($row['flags'])) {
             foreach (explode("\n", $row['flags']) as $flag) {
                 if ($flag !== '') {
                     $result->addFlag($flag);
                 }
             }
         }
     }
     return $result;
 }
開發者ID:ceko,項目名稱:concrete5-1,代碼行數:44,代碼來源:Translation.php


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