本文整理汇总了PHP中PO::comment_block方法的典型用法代码示例。如果您正苦于以下问题:PHP PO::comment_block方法的具体用法?PHP PO::comment_block怎么用?PHP PO::comment_block使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PO
的用法示例。
在下文中一共展示了PO::comment_block方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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
*/
function export_entry(&$entry)
{
if (is_null($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 (!is_null($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];
$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) {
$po[] = "msgstr[{$i}] " . PO::poify($translation);
}
}
return implode("\n", $po);
}