diff options
Diffstat (limited to 'db/i18n.php')
-rw-r--r-- | db/i18n.php | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/db/i18n.php b/db/i18n.php index 0942802..b4f7cbc 100644 --- a/db/i18n.php +++ b/db/i18n.php @@ -10,12 +10,23 @@ function populateI18n ($locale, $poFile) { while ($line = fgets($handle)) { if (str_starts_with($line, 'msgid')) { $nextLine = fgets($handle); - preg_match('/"(.*)"/', $line, $msgid); - preg_match('/"(.*)"/', $nextLine, $msgstr); + preg_match('/"(.*)"/', $line, $msgidMatch); + preg_match('/"(.*)"/', $nextLine, $msgstrMatch); - if (empty($msgid[1]) || str_starts_with($msgid[1], 'PROJECT DESCRIPTION')) continue; + if (empty($msgidMatch[1]) || str_starts_with($msgidMatch[1], 'PROJECT DESCRIPTION')) continue; + $msgid = $msgidMatch[1]; - $i18n[$locale][$msgid[1]] = mb_convert_encoding($msgstr[1], 'UTF-8'); + // 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); + } + + $i18n[$locale][$msgid] = mb_convert_encoding($msgstr, 'UTF-8'); } } } |