Class PO

Description

Routines for working with PO files

Located in /gp-includes/backpress/pomo/po.php (line 20)

Gettext_Translations
   |
   --PO
Variable Summary
Method Summary
static void comment_block (string $text, [string $char = ' '])
static string|bool export_entry (object &$entry)
static string poify (string $string)
static void prepend_each_line (string $string, string $with)
static void trim_quotes ( $s)
static string unpoify (string $string)
void add_comment_to_entry ( &$entry,  $po_comment_line)
string export ([bool $include_headers = true])
string export_entries ()
string export_headers ()
bool export_to_file (string $filename, [bool $include_headers = true])
void import_from_file ( $filename)
void read_entry ( $f, [ $lineno = 0])
void read_line ( $f, [ $action = 'read'])
Variables
mixed $comments_before_headers = '' (line 22)
Methods
static method comment_block (line 183)

Prepare a text as a comment -- wraps the lines and prepends # and a special character to each line

  • access: public
static void comment_block (string $text, [string $char = ' '])
  • string $text: the comment text
  • string $char: character to denote a special PO comment, like :, default is a space
static method export_entry (line 196)

Builds a string from the entry for inclusion in PO file

  • return: PO-style formatted string for the entry or false if the entry is empty
  • access: public
static string|bool export_entry (object &$entry)
  • object &$entry: the entry to convert to po string
static method poify (line 100)

Formats a string in PO-style

  • return: the poified string
  • access: public
static string poify (string $string)
  • string $string: the string to format
static method prepend_each_line (line 163)

Inserts $with in the beginning of every new line of $string and returns the modified string

  • access: public
static void prepend_each_line (string $string, string $with)
  • string $string: prepend lines in this string
  • string $with: prepend lines with this string
static method trim_quotes (line 379)
  • access: public
static void trim_quotes ( $s)
  • $s
static method unpoify (line 131)

Gives back the original string from a PO-formatted string

  • return: enascaped string
  • access: public
static string unpoify (string $string)
  • string $string: PO-formatted string
add_comment_to_entry (line 365)
void add_comment_to_entry ( &$entry,  $po_comment_line)
  • &$entry
  • $po_comment_line
export (line 58)

Exports the whole PO file as a string

  • return: ready for inclusion in PO file string for headers and all the enrtries
string export ([bool $include_headers = true])
  • bool $include_headers: whether to include the headers in the export
export_entries (line 47)

Exports all entries to PO format

  • return: sequence of mgsgid/msgstr PO strings, doesn't containt newline at the end
string export_entries ()
export_headers (line 29)

Exports headers to a PO entry

  • return: msgid/msgstr PO entry for this PO file headers, doesn't contain newline at the end
string export_headers ()
export_to_file (line 75)

Same as export, but writes the result to a file

  • return: true on success, false on error
bool export_to_file (string $filename, [bool $include_headers = true])
  • string $filename: where to write the PO string
  • bool $include_headers: whether to include tje headers in the export
import_from_file (line 218)
void import_from_file ( $filename)
  • $filename
read_entry (line 242)
void read_entry ( $f, [ $lineno = 0])
  • $f
  • $lineno
read_line (line 347)
void read_line ( $f, [ $action = 'read'])
  • $f
  • $action
set_comment_before_headers (line 89)

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

void set_comment_before_headers ( $text)
  • $text

Documentation generated on Thu, 20 Jun 2013 01:46:40 +0100 by phpDocumentor 1.4.3