{}.
19 foreach ($translations->getHeaders() as $headerName => $headerValue) {
20 $headers .=
"$headerName: $headerValue\n";
23 if ($headers !==
'') {
24 $array[
''] = $headers;
27 foreach ($translations as $translation) {
28 if (!$translation->hasTranslation() && !static::$includeEmptyTranslations) {
32 if ($translation->hasContext()) {
33 $originalString = $translation->getContext().
"\x04".$translation->getOriginal();
35 $originalString = $translation->getOriginal();
38 $array[$originalString] = $translation;
42 $numEntries = count($array);
44 $translationsTable =
'';
45 $originalsIndex =
array();
46 $translationsIndex =
array();
48 foreach ($array as $originalString => $translation) {
49 if (is_string($translation)) {
51 $translationString = $translation;
54 if ($translation->hasPlural()) {
55 $originalString .=
"\x00".$translation->getPlural();
57 $translationString = $translation->getTranslation();
59 if ($translation->hasPluralTranslation()) {
60 $translationString .=
"\x00".implode(
"\x00", $translation->getPluralTranslation());
64 $originalsIndex[] =
array(
'relativeOffset' => strlen($originalsTable),
'length' => strlen($originalString));
65 $originalsTable .= $originalString.
"\x00";
66 $translationsIndex[] =
array(
'relativeOffset' => strlen($translationsTable),
'length' => strlen($translationString));
67 $translationsTable .= $translationString.
"\x00";
71 $originalsIndexOffset = 7 * 4;
74 $originalsIndexSize = $numEntries * (4 + 4);
77 $translationsIndexOffset = $originalsIndexOffset + $originalsIndexSize;
80 $translationsIndexSize = $numEntries * (4 + 4);
83 $originalsStringsOffset = $translationsIndexOffset + $translationsIndexSize;
86 $translationsStringsOffset = $originalsStringsOffset + strlen($originalsTable);
92 $mo .= pack(
'L', 0x950412de);
98 $mo .= pack(
'L', $numEntries);
101 $mo .= pack(
'L', $originalsIndexOffset);
104 $mo .= pack(
'L', $translationsIndexOffset);
110 $mo .= pack(
'L', $translationsIndexOffset + $translationsIndexSize);
113 foreach ($originalsIndex as
$info) {
114 $mo .= pack(
'L', $info[
'length']);
115 $mo .= pack(
'L', $originalsStringsOffset + $info[
'relativeOffset']);
119 foreach ($translationsIndex as $info) {
120 $mo .= pack(
'L', $info[
'length']);
121 $mo .= pack(
'L', $translationsStringsOffset + $info[
'relativeOffset']);
125 $mo .= $originalsTable;
128 $mo .= $translationsTable;
Create styles array
The data for the language used.