Skip to content

Commit a19c1c4

Browse files
committed
getopts
1 parent 04968a6 commit a19c1c4

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

i18n_extract.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function wordAwareStringSplit(string $string, int $maxLengthOfLine): array
119119

120120
$potCreationDate = date('Y-m-d H:i:O');
121121

122-
$head = <<<POT
122+
$potfile = <<<POT
123123
#, fuzzy
124124
msgid ""
125125
msgstr ""
@@ -133,26 +133,25 @@ function wordAwareStringSplit(string $string, int $maxLengthOfLine): array
133133
POT;
134134

135135
// Add search paths
136-
$head .= trim($head) . "\n";
136+
$potfile .= trim($potfile) . "\n";
137137
foreach ($paths as $i => $path) {
138-
$head .= '"X-Poedit-SearchPath-' . $i . ': ' . $path . '\\n"' . "\n";
138+
$potfile .= '"X-Poedit-SearchPath-' . $i . ': ' . $path . '\\n"' . "\n";
139139
}
140140

141-
$body = '';
142141
foreach ($strings as $string => $locations) {
143-
$body .= "\n";
142+
$potfile .= "\n";
144143
foreach ($locations as $location) {
145-
$body .= '#: ' . $location . "\n";
144+
$potfile .= '#: ' . $location . "\n";
146145
}
147146
$msgid = wordAwareStringSplit($string, 80);
148-
$body .= 'msgid ';
147+
$potfile .= 'msgid ';
149148
foreach ($msgid as $s) {
150-
$body .= json_encode($s, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . "\n";
149+
$potfile .= json_encode($s, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . "\n";
151150
}
152-
$body .= 'msgstr ""' . "\n";
151+
$potfile .= 'msgstr ""' . "\n";
153152
}
154153

155154
if (!file_exists('i18n')) {
156155
mkdir('i18n');
157156
}
158-
file_put_contents('i18n/' . $domain . '.pot', $head . "\n" . $body);
157+
file_put_contents('i18n/' . $domain . '.pot', $potfile);

0 commit comments

Comments
 (0)