PHP Класс Neos\Flow\I18n\Xliff\XliffModel

Please note that plural forms for particular translation unit are accessed with integer index (and not string like 'zero', 'one', 'many' etc). This is because they are indexed such way in XLIFF files in order to not break tools' support. There are very few XLIFF editors, but they are nice Gettext's .po editors available. Gettext supports plural forms, but it indexes them using integer numbers. Leaving it this way in .xlf files, makes it possible to easily convert them to .po (e.g. using xliff2po from Translation Toolkit), edit with Poedit, and convert back to .xlf without any information loss (using po2xliff).
См. также: http://docs.oasis-open.org/xliff/v1.2/xliff-profile-po/xliff-profile-po-1.2-cd02.html#s.detailed_mapping.tu
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$cache Neos\Cache\Frontend\VariableFrontend
$i18nLogger Neos\Flow\Log\LoggerInterface
$locale Neos\Flow\I18n\Locale
$sourcePath string Absolute path to the file which is represented by this class instance.
$xmlParsedData array Parsed data (structure depends on concrete model).
$xmlParser XliffParser Concrete XML parser which is set by more specific model extending this class.

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

Метод Описание
__construct ( string $sourcePath, Locale $locale )
getTargetBySource ( string $source, integer $pluralFormIndex ) : mixed Returns translated label ("target" tag in XLIFF) from source-target pair where "source" tag equals to $source parameter.
getTargetByTransUnitId ( string $transUnitId, integer $pluralFormIndex ) : mixed Returns translated label ("target" tag in XLIFF) for the id given.
initializeObject ( ) : void When it's called, XML file is parsed (using parser set in $xmlParser) or cache is loaded, if available.
injectCache ( Neos\Cache\Frontend\VariableFrontend $cache ) : void Injects the Flow_I18n_XmlModelCache cache
injectParser ( XliffParser $parser ) : void

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

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

public __construct ( string $sourcePath, Locale $locale )
$sourcePath string
$locale Neos\Flow\I18n\Locale The locale represented by the file

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

Returns translated label ("target" tag in XLIFF) from source-target pair where "source" tag equals to $source parameter.
public getTargetBySource ( string $source, integer $pluralFormIndex ) : mixed
$source string Label in original language ("source" tag in XLIFF)
$pluralFormIndex integer Index of plural form to use (starts with 0)
Результат mixed Translated label or FALSE on failure

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

Id is compared with "id" attribute of "trans-unit" tag (see XLIFF specification for details).
public getTargetByTransUnitId ( string $transUnitId, integer $pluralFormIndex ) : mixed
$transUnitId string The "id" attribute of "trans-unit" tag in XLIFF
$pluralFormIndex integer Index of plural form to use (starts with 0)
Результат mixed Translated label or FALSE on failure

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

When it's called, XML file is parsed (using parser set in $xmlParser) or cache is loaded, if available.
public initializeObject ( ) : void
Результат void

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

Injects the Flow_I18n_XmlModelCache cache
public injectCache ( Neos\Cache\Frontend\VariableFrontend $cache ) : void
$cache Neos\Cache\Frontend\VariableFrontend
Результат void

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

public injectParser ( XliffParser $parser ) : void
$parser XliffParser
Результат void

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

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

protected VariableFrontend,Neos\Cache\Frontend $cache
Результат Neos\Cache\Frontend\VariableFrontend

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

protected LoggerInterface,Neos\Flow\Log $i18nLogger
Результат Neos\Flow\Log\LoggerInterface

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

protected Locale,Neos\Flow\I18n $locale
Результат Neos\Flow\I18n\Locale

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

Absolute path to the file which is represented by this class instance.
protected string $sourcePath
Результат string

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

Parsed data (structure depends on concrete model).
protected array $xmlParsedData
Результат array

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

Concrete XML parser which is set by more specific model extending this class.
protected XliffParser,Neos\Flow\I18n\Xliff $xmlParser
Результат XliffParser