本文整理汇总了PHP中PO::set_comment_before_headers方法的典型用法代码示例。如果您正苦于以下问题:PHP PO::set_comment_before_headers方法的具体用法?PHP PO::set_comment_before_headers怎么用?PHP PO::set_comment_before_headers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PO
的用法示例。
在下文中一共展示了PO::set_comment_before_headers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xgettext
function xgettext($project, $dir, $output_file, $placeholders = array(), $excludes = array(), $includes = array())
{
$meta = array_merge($this->meta['default'], $this->meta[$project]);
$placeholders = array_merge($meta, $placeholders);
$meta['output'] = $this->realpath_missing($output_file);
$placeholders['year'] = date('Y');
$placeholder_keys = array_map(create_function('$x', 'return "{".$x."}";'), array_keys($placeholders));
$placeholder_values = array_values($placeholders);
foreach ($meta as $key => $value) {
$meta[$key] = str_replace($placeholder_keys, $placeholder_values, $value);
}
$originals = $this->extractor->extract_from_directory($dir, $excludes, $includes);
$pot = new PO();
$pot->entries = $originals->entries;
$pot->set_header('Project-Id-Version', $meta['package-name'] . ' ' . $meta['package-version']);
$pot->set_header('Report-Msgid-Bugs-To', $meta['msgid-bugs-address']);
$pot->set_header('POT-Creation-Date', gmdate('Y-m-d H:i:s+00:00'));
$pot->set_header('MIME-Version', '1.0');
$pot->set_header('Content-Type', 'text/plain; charset=UTF-8');
$pot->set_header('Content-Transfer-Encoding', '8bit');
$pot->set_header('PO-Revision-Date', date('Y') . '-MO-DA HO:MI+ZONE');
$pot->set_header('Last-Translator', 'FULL NAME <EMAIL@ADDRESS>');
$pot->set_header('Language-Team', 'LANGUAGE <LL@li.org>');
$pot->set_comment_before_headers($meta['comments']);
$pot->export_to_file($output_file);
return true;
}