diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-09-02 14:59:09 +0200 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-09-02 14:59:09 +0200 |
commit | 2030caa0c85102b1cf6131dd9eefef4a347cda42 (patch) | |
tree | 9188abac0d7b7730ded1e8e154c3f7c589f785cf /db/i18n.php | |
parent | 1d29ee6d87d3794a9319bca5bf36afdfe176072c (diff) |
translations and story
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'); |