POMO Notes - WordPress-Thinstall/wordpress-develop GitHub Wiki

This seems like an isolated set of files so I'm going to document them together. I've probably also missed something... Trying to un-pick. This is just the interfaces, not any specific implementation detail. po.php has been omitted as I cannot find it included in the source code. Po now included. Interfaces need to be worked out a lot more...

interface TranslationEntryInterface {
    function key();
    function merge_with(&$other);
}

interface TranslationsStreamInterface {
    function setEndian($endian);
    function readint32();
    function readint32array($count);
    function substr($string, $start, $length)
    function strlen($string)
    function str_split($string, $chunk_size)
    function pos()
    function is_resource()
    function close()
    function read($bytes);
    function seekto($pos);
    function read_all();
}

interface TranslationsFileStreamInterface extends TranslationsStreamInterface {
    function feof();
}

interface TranslationStringReaderInterface extends TranslationsStreamInterface {
    function length();
}

interface TranslationsInterface {
    function add_entry($entry);
    function add_entry_or_merge($entry)
    function set_header($header, $value)
    function set_headers($headers)
    function get_header($header)
    function translate_entry(&$entry)
    function translate($singular, $context=null)
    function select_plural_form($count)
    function get_plural_forms_count()
    function translate_plural($singular, $plural, $count, $context = null)
    function merge_with(&$other)
    function merge_originals_with(&$other)
}

interface GetTextTranslationsInterface extends TranslationsInterface {
    function gettext_select_plural_form($count);
    function nplurals_and_expression_from_header($header);
    function make_plural_form_function($nplurals, $expression);
    function parenthesize_plural_exression($expression);
    function make_headers($translation);
}

interface FileReadableInterface {
    function import_from_file($filename);
}

interface FileWriteableInterface {
    function export_to_file($filename);
}

interface MOInterface extends GetTextTranslationsInterface, FileReadableInterface, FileWriteableInterface {
    public function get_filename();
    function export();
    function is_entry_good_for_export( $entry );
    function export_to_file_handle($fh);
    function export_original($entry);
    function export_translations($entry);
    function export_headers();
    function get_byteorder($magic);
    function import_from_reader($reader);
    function &make_entry($original, $translation);
}

interface POInterface extends GetTextTranslationsInterface, FileReadableInterface {
    function export_headers();
    function export_entries();
    function export($include_headers = true);
    function export_to_file($filename, $include_headers = true);
    function set_comment_before_headers( $text );
    public static function poify($string); // bad smell Injectable logic?
    public static function unpoify($string); // bad smell. Injectable logic?
    public static function prepend_each_line($string, $with);
    public static function comment_block($text, $char=' ');
    public static function export_entry(&$entry);
    public static function match_begin_and_end_newlines( $translation, $original );
    function read_entry($f, $lineno = 0);
    function read_line($f, $action = 'read');
    function add_comment_to_entry(&$entry, $po_comment_line);
    public static function trim_quotes($s);
}