public static function toString(Stringset $set)
    {
        $str = '';
        for ($i = 0; $i < $set->size(); $i += 1) {
            $item = $set->item($i);
            if (count($item['flags']) > 0) {
                $str .= "#, " . implode(", ", $item['flags']) . "\n";
            }

            if ($item['context'] !== null) {
                $str .= "msgctxt " . '"' . $item['context'] . '"' . "\n";
            }

            $str .= "msgid " . '"' . self::escapeString($item['id']) . '"' . "\n";

            if ($item['plural'] !== null) {
                $str .= "msgid_plural " . '"' . self::escapeString($item['plural']) . '"' . "\n";
            }

            if (count($item['strings']) === 1) {
                $str .= "msgstr " . '"' . self::escapeString($item['strings'][0]) . '"' . "\n";
            } else {
                for ($j = 0; $j < count($item['strings']); $j += 1) {
                    $str .= "msgstr[" . $i . "] " . '"' . self::escapeString($item['strings'][0]) . '"' . "\n";
                }
            }
            $str .= "\n";
        }
        return $str;
    }
public static function toString(Stringset $set)
    {
        $str = '';
        for ($i = 0; $i < $set->size(); $i += 1) {
            $item = $set->item($i);
            if (count($item['flags']) > 0) {
                $str .= "#, " . implode(", ", $item['flags']) . "\n";
            }

            if ($item['context'] !== null) {
                $str .= "msgctxt " . '"' . $item['context'] . '"' . "\n";
            }

            $str .= "msgid " . '"' . self::escapeString($item['id']) . '"' . "\n";

            if ($item['plural'] !== null) {
                $str .= "msgid_plural " . '"' . self::escapeString($item['plural']) . '"' . "\n";
            }

            if (count($item['strings']) === 1) {
                $str .= "msgstr " . '"' . self::escapeString($item['strings'][0]) . '"' . "\n";
            } else {
                for ($j = 0; $j < count($item['strings']); $j += 1) {
                    $str .= "msgstr[" . $i . "] " . '"' . self::escapeString($item['strings'][0]) . '"' . "\n";
                }
            }
            $str .= "\n";
        }
        return $str;
    }
public static function toString ( Stringset $ set ) { $ str = '' ; for ( $ i = 0 ; $ i < $ set -> size ( ) ; $ i += 1 ) { $ item = $ set -> item ( $ i ) ; if ( count ( $ item [ 'flags' ] ) > 0 ) { $ str .= "#, " . implode ( ", " , $ item [ 'flags' ] ) . "\n" ; } if ( $ item [ 'context' ] !== null ) { $ str .= "msgctxt " . '"' . $ item [ 'context' ] . '"' . "\n" ; } $ str .= "msgid " . '"' . self :: escapeString ( $ item [ 'id' ] ) . '"' . "\n" ; if ( $ item [ 'plural' ] !== null ) { $ str .= "msgid_plural " . '"' . self :: escapeString ( $ item [ 'plural' ] ) . '"' . "\n" ; } if ( count ( $ item [ 'strings' ] ) === 1 ) { $ str .= "msgstr " . '"' . self :: escapeString ( $ item [ 'strings' ] [ 0 ] ) . '"' . "\n" ; } else { for ( $ j = 0 ; $ j < count ( $ item [ 'strings' ] ) ; $ j += 1 ) { $ str .= "msgstr[" . $ i . "] " . '"' . self :: escapeString ( $ item [ 'strings' ] [ 0 ] ) . '"' . "\n" ; } } $ str .= "\n" ; } return $ str ; }
Takes a Stringset and an array of options and creates a po formatted string.
@param Stringset $set
@return string
Takes a Stringset and an array of options and creates a po formatted string .