FileAccess Orion

MoFileLoader extends FileLoader
in package

ArrayLoader loads translations from a PHP array.

Tags
copyright

Copyright (c) 2010, Union of RAD http://union-of-rad.org (http://lithify.me/)

Table of Contents

MO_BIG_ENDIAN_MAGIC  = 0xde120495
Magic used for validating the format of a MO file as well as detecting if the machine used to create that file was big endian.
MO_HEADER_SIZE  = 28
The size of the header of a MO file in bytes.
MO_LITTLE_ENDIAN_MAGIC  = 0x950412de
Magic used for validating the format of a MO file as well as detecting if the machine used to create that file was little endian.
load()  : MessageCatalogue
Loads a locale.
loadResource()  : array<string|int, mixed>
Parses machine object (MO) format, independent of the machine's endian it was created on. Both 32bit and 64bit systems are supported.
flatten()  : array<string|int, mixed>
Flattens an nested array of translations.
readLong()  : int
Reads an unsigned long from stream respecting endianness.

Constants

MO_BIG_ENDIAN_MAGIC

Magic used for validating the format of a MO file as well as detecting if the machine used to create that file was big endian.

public mixed MO_BIG_ENDIAN_MAGIC = 0xde120495

MO_HEADER_SIZE

The size of the header of a MO file in bytes.

public mixed MO_HEADER_SIZE = 28

MO_LITTLE_ENDIAN_MAGIC

Magic used for validating the format of a MO file as well as detecting if the machine used to create that file was little endian.

public mixed MO_LITTLE_ENDIAN_MAGIC = 0x950412de

Methods

load()

Loads a locale.

public load(mixed $resource, mixed $locale[, mixed $domain = 'messages' ]) : MessageCatalogue
Parameters
$resource : mixed

A resource

$locale : mixed

A locale

$domain : mixed = 'messages'

The domain

Return values
MessageCatalogue

A MessageCatalogue instance

loadResource()

Parses machine object (MO) format, independent of the machine's endian it was created on. Both 32bit and 64bit systems are supported.

protected loadResource(mixed $resource) : array<string|int, mixed>
Parameters
$resource : mixed
Return values
array<string|int, mixed>

flatten()

Flattens an nested array of translations.

private flatten(array<string|int, mixed> $messages) : array<string|int, mixed>

The scheme used is: 'key' => ['key2' => ['key3' => 'value']] Becomes: 'key.key2.key3' => 'value'

Parameters
$messages : array<string|int, mixed>
Return values
array<string|int, mixed>

readLong()

Reads an unsigned long from stream respecting endianness.

private readLong(resource $stream, bool $isBigEndian) : int
Parameters
$stream : resource
$isBigEndian : bool
Return values
int

Search results