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


PHP PO::match_begin_and_end_newlines方法代碼示例

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


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

示例1: test_match_begin_and_end_newlines

 /**
  * @dataProvider data_match_begin_and_end_newlines
  */
 function test_match_begin_and_end_newlines($original, $translation, $expected_translation, $message)
 {
     $this->assertEquals($expected_translation, PO::match_begin_and_end_newlines($translation, $original), $message);
 }
開發者ID:pedro-mendonca,項目名稱:GlotPress-WP,代碼行數:7,代碼來源:test_po.php

示例2: export_entry

 /**
  * Builds a string from the entry for inclusion in PO file
  *
  * @static
  * @param object &$entry the entry to convert to po string
  * @return string|bool PO-style formatted string for the entry or
  * 	false if the entry is empty
  */
 public static function export_entry(&$entry)
 {
     if (null === $entry->singular || '' === $entry->singular) {
         return false;
     }
     $po = array();
     if (!empty($entry->translator_comments)) {
         $po[] = PO::comment_block($entry->translator_comments);
     }
     if (!empty($entry->extracted_comments)) {
         $po[] = PO::comment_block($entry->extracted_comments, '.');
     }
     if (!empty($entry->references)) {
         $po[] = PO::comment_block(implode(' ', $entry->references), ':');
     }
     if (!empty($entry->flags)) {
         $po[] = PO::comment_block(implode(", ", $entry->flags), ',');
     }
     if ($entry->context) {
         $po[] = 'msgctxt ' . PO::poify($entry->context);
     }
     $po[] = 'msgid ' . PO::poify($entry->singular);
     if (!$entry->is_plural) {
         $translation = empty($entry->translations) ? '' : $entry->translations[0];
         $translation = PO::match_begin_and_end_newlines($translation, $entry->singular);
         $po[] = 'msgstr ' . PO::poify($translation);
     } else {
         $po[] = 'msgid_plural ' . PO::poify($entry->plural);
         $translations = empty($entry->translations) ? array('', '') : $entry->translations;
         foreach ($translations as $i => $translation) {
             $translation = PO::match_begin_and_end_newlines($translation, $entry->plural);
             $po[] = "msgstr[{$i}] " . PO::poify($translation);
         }
     }
     return implode("\n", $po);
 }
開發者ID:royalwang,項目名稱:wp-scripts,代碼行數:44,代碼來源:po.php


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