diff -r 2f6f6f7551ca -r 32102edaa81b web/wp-includes/pomo/po.php --- a/web/wp-includes/pomo/po.php Thu Sep 16 15:45:36 2010 +0000 +++ b/web/wp-includes/pomo/po.php Mon Nov 19 18:26:13 2012 +0100 @@ -2,7 +2,7 @@ /** * Class for working with PO files * - * @version $Id: po.php 283 2009-09-23 16:21:51Z nbachiyski $ + * @version $Id: po.php 589 2010-12-18 01:40:57Z nbachiyski $ * @package pomo * @subpackage po */ @@ -19,6 +19,7 @@ if ( !class_exists( 'PO' ) ): class PO extends Gettext_Translations { + var $comments_before_headers = ''; /** * Exports headers to a PO entry @@ -31,7 +32,11 @@ $header_string.= "$header: $value\n"; } $poified = PO::poify($header_string); - return rtrim("msgid \"\"\nmsgstr $poified"); + if ($this->comments_before_headers) + $before_headers = $this->prepend_each_line(rtrim($this->comments_before_headers)."\n", '# '); + else + $before_headers = ''; + return rtrim("{$before_headers}msgid \"\"\nmsgstr $poified"); } /** @@ -75,6 +80,15 @@ if (false === $res) return false; return fclose($fh); } + + /** + * Text to include as a comment before the start of the PO contents + * + * Doesn't need to include # in the beginning of lines, these are added automatically + */ + function set_comment_before_headers( $text ) { + $this->comments_before_headers = $text; + } /** * Formats a string in PO-style