MoFile final class
Minn\I18n\MoFile · public/minn/src/Minn/I18n/MoFile.php · 106 lines
The GNU gettext binary catalog (.mo), read and written. The file opens with a magic number that also says its byte order, then a revision, the message count, and the offsets of two tables of (length, offset) pairs: the originals, then the translations. The entry with an empty original carries the headers; a plural original is "singular NUL plural" and its translations are NUL-separated; a context precedes the original with a 0x04 byte.
Constants and properties
| private | MAGIC = 2500072158 |
Public
| static | read(string $bytes): ?Minn\I18n\Catalog# | The catalog in a .mo file's bytes, or null when they are not one. | ||||||
| static | write(array $headers, array $entries): string# | A .mo file's bytes for headers and entries, little-endian, entries in the sorted order gettext expects.
|
Internals 4
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | byteOrder(string $bytes): ?string# | "V" for a little-endian file, "N" for a big-endian one, null for anything else. | |||
| private | string(string $bytes, string $format, int $at): ?string# | ||||
| private | headers(string $block): array# | @return array<string, string> | |||
| private | headerBlock(array $headers): string# |
|
Nothing matches.