PHP Класс Prado\I18N\core\MessageSource_gettext

Using Gettext MO format as the message source for translation. The gettext classes are based on PEAR's gettext MO and PO classes. See the MessageSource::factory() method to instantiate this class.
Наследование: extends MessageSource
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$dataExt string Message data filename extension.
$dataSeparator string Separator between culture name and source.
$poExt string PO data filename extension

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

Метод Описание
__construct ( $source )
catalogues ( ) : array Returns a list of catalogue as key and all it variants as value.
delete ( $message, $catalogue = 'messages' ) : boolean Delete a particular message from the specified catalogue.
save ( $catalogue = 'messages' ) : boolean Save the list of untranslated blocks to the translation source.
update ( $text, $target, $comments, $catalogue = 'messages' ) : boolean Update the translation.

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

Метод Описание
createMessageTemplate ( $catalogue )
getCatalogueList ( $catalogue ) : array Get all the variants of a particular catalogue.
getCatalogues ( $dir = null, $variant = null ) : array Returns a list of catalogue and its culture ID. This takes care of directory structures.
getLastModified ( $source ) : integer Get the last modified unix-time for this particular catalogue+variant.
getSource ( $variant ) : string Get the MO file for a specific message catalogue and cultural vairant.
isValidSource ( $filename ) : boolean Determin if the MO file source is valid.
loadData ( $filename ) : array Load the messages from a MO file.

Приватные методы

Метод Описание
getCatalogueByDir ( $catalogue ) : array Traverse through the directory structure to find the catalogues.
getPOFile ( $MOFile )
getVariants ( $catalogue = 'messages' ) : string Get the variant for a catalogue depending on the current culture.

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

__construct() публичный Метод

public __construct ( $source )

catalogues() публичный Метод

Returns a list of catalogue as key and all it variants as value.
public catalogues ( ) : array
Результат array list of catalogues

createMessageTemplate() защищенный Метод

protected createMessageTemplate ( $catalogue )

delete() публичный Метод

Delete a particular message from the specified catalogue.
public delete ( $message, $catalogue = 'messages' ) : boolean
Результат boolean true if deleted, false otherwise.

getCatalogueList() защищенный Метод

Get all the variants of a particular catalogue.
protected getCatalogueList ( $catalogue ) : array
Результат array list of all variants for this catalogue.

getCatalogues() защищенный Метод

E.g. array('messages','en_AU')
protected getCatalogues ( $dir = null, $variant = null ) : array
Результат array list of catalogues

getLastModified() защищенный Метод

Just use the file modified time.
protected getLastModified ( $source ) : integer
Результат integer last modified in unix-time format.

getSource() защищенный Метод

Get the MO file for a specific message catalogue and cultural vairant.
protected getSource ( $variant ) : string
Результат string full path to the MO file.

isValidSource() защищенный Метод

Determin if the MO file source is valid.
protected isValidSource ( $filename ) : boolean
Результат boolean true if valid, false otherwise.

loadData() защищенный Метод

Load the messages from a MO file.
protected loadData ( $filename ) : array
Результат array of messages.

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

If the translation was not found, you should add those strings to the translation source via the append() method.
public save ( $catalogue = 'messages' ) : boolean
Результат boolean true if saved successfuly, false otherwise.

update() публичный Метод

Update the translation.
public update ( $text, $target, $comments, $catalogue = 'messages' ) : boolean
Результат boolean true if translation was updated, false otherwise.

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

$dataExt защищенное свойство

Message data filename extension.
protected string $dataExt
Результат string

$dataSeparator защищенное свойство

Separator between culture name and source.
protected string $dataSeparator
Результат string

$poExt защищенное свойство

PO data filename extension
protected string $poExt
Результат string