Browse Source

Merge pull request #11865 from Wouter0100/fix/po-context-multiline

Allow context to be multiple lines in po files
Mark Story 8 years ago
parent
commit
7e0a02d470

+ 1 - 1
src/I18n/Parser/PoFileParser.php

@@ -98,7 +98,7 @@ class PoFileParser
             } elseif (substr($line, 0, 9) === 'msgctxt "') {
                 $item['context'] = substr($line, 9, -1);
             } elseif ($line[0] === '"') {
-                $continues = isset($item['translated']) ? 'translated' : 'ids';
+                $continues = isset($item['context']) ? 'context' : (isset($item['translated']) ? 'translated' : 'ids');
 
                 if (is_array($item[$continues])) {
                     end($item[$continues]);

+ 2 - 1
tests/test_app/TestApp/Locale/rule_1_po/default.po

@@ -15,7 +15,8 @@ msgstr ""
 msgid "Plural Rule 1"
 msgstr "Plural Rule 1 (translated)"
 
-msgctxt "This is the context"
+msgctxt ""
+"This is the context"
 msgid "%d = 1"
 msgstr "First Context trasnlation"