diff options
Diffstat (limited to 'db/i18n.php')
-rw-r--r-- | db/i18n.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/db/i18n.php b/db/i18n.php index b4f7cbc..5cde5c2 100644 --- a/db/i18n.php +++ b/db/i18n.php @@ -14,16 +14,20 @@ function populateI18n ($locale, $poFile) { preg_match('/"(.*)"/', $nextLine, $msgstrMatch); if (empty($msgidMatch[1]) || str_starts_with($msgidMatch[1], 'PROJECT DESCRIPTION')) continue; - $msgid = $msgidMatch[1]; + $msgid = str_replace('\n', '', trim($msgidMatch[1])); // get lines immediately after msgstr $msgstr = $msgstrMatch[1]; $msgstrNextLine = fgets($handle); - while (! empty(trim($msgstrNextLine))) { - preg_match('/"(.*)"/', $msgstrNextLine, $msgstrNextLineMatch); - $msgstr .= $msgstrNextLineMatch[1]; - - $msgstrNextLine = fgets($handle); + if (str_starts_with($msgstrNextLine, 'msgid')) { + fseek($handle, -strlen($msgstrNextLine), SEEK_CUR); + } else { + while (! empty(trim($msgstrNextLine))) { + preg_match('/"(.*)"/', $msgstrNextLine, $msgstrNextLineMatch); + $msgstr .= $msgstrNextLineMatch[1]; + + $msgstrNextLine = fgets($handle); + } } $i18n[$locale][$msgid] = mb_convert_encoding($msgstr, 'UTF-8'); |