PHP Класс yii\i18n\GettextMoFile

This class is written by adapting Michael's Gettext_MO class in PEAR. Please refer to the following license terms. Copyright (c) 2004-2005, Michael Wallner . All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
С версии: 2.0
Автор: Qiang Xue ([email protected])
Наследование: extends yii\i18n\GettextFile
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$useBigEndian whether to use big-endian when reading and writing an integer.

Открытые методы

Метод Описание
load ( string $filePath, string $context ) : array Loads messages from an MO file.
save ( string $filePath, array $messages ) Saves messages to an MO file.

Защищенные методы

Метод Описание
readBytes ( resource $fileHandle, integer $byteCount = 1 ) : string Reads one or several bytes.
readInteger ( resource $fileHandle ) : integer Reads a 4-byte integer.
readString ( resource $fileHandle, integer $length, integer $offset = null ) : string Reads a string.
writeBytes ( resource $fileHandle, string $bytes ) : integer Write bytes.
writeInteger ( resource $fileHandle, integer $integer ) : integer Writes a 4-byte integer.
writeString ( resource $fileHandle, string $string ) : integer Writes a string.

Описание методов

load() публичный метод

Loads messages from an MO file.
public load ( string $filePath, string $context ) : array
$filePath string file path
$context string message context
Результат array message translations. Array keys are source messages and array values are translated messages: source message => translated message.

readBytes() защищенный метод

Reads one or several bytes.
protected readBytes ( resource $fileHandle, integer $byteCount = 1 ) : string
$fileHandle resource to read from
$byteCount integer to be read
Результат string bytes

readInteger() защищенный метод

Reads a 4-byte integer.
protected readInteger ( resource $fileHandle ) : integer
$fileHandle resource to read from
Результат integer the result

readString() защищенный метод

Reads a string.
protected readString ( resource $fileHandle, integer $length, integer $offset = null ) : string
$fileHandle resource file handle
$length integer of the string
$offset integer of the string in the file. If null, it reads from the current position.
Результат string the result

save() публичный метод

Saves messages to an MO file.
public save ( string $filePath, array $messages )
$filePath string file path
$messages array message translations. Array keys are source messages and array values are translated messages: source message => translated message. Note if the message has a context, the message ID must be prefixed with the context with chr(4) as the separator.

writeBytes() защищенный метод

Write bytes.
protected writeBytes ( resource $fileHandle, string $bytes ) : integer
$fileHandle resource to write to
$bytes string to be written
Результат integer how many bytes are written

writeInteger() защищенный метод

Writes a 4-byte integer.
protected writeInteger ( resource $fileHandle, integer $integer ) : integer
$fileHandle resource to write to
$integer integer to be written
Результат integer how many bytes are written

writeString() защищенный метод

Writes a string.
protected writeString ( resource $fileHandle, string $string ) : integer
$fileHandle resource to write to
$string string to be written
Результат integer how many bytes are written

Описание свойств

$useBigEndian публичное свойство

whether to use big-endian when reading and writing an integer.
public $useBigEndian