Browse Source

Don't replace plural message ids with singular ones.

When a messageid is defined as a plural key, and *then* a singular one
in the same context, the singular only message id should be ignored as
message selection methods will choose the first value from the plural
values. The plural translations obviously cannot read multiple values
from the singular data, causing missed messages.

Refs #11089
Mark Story 8 years ago
parent
commit
ba43bd6440
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/I18n/Parser/PoFileParser.php

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

@@ -142,9 +142,9 @@ class PoFileParser
 
         $translation = stripcslashes($translation);
 
-        if ($context !== null) {
+        if ($context !== null && !isset($messages[$singular]['_context'][$context])) {
             $messages[$singular]['_context'][$context] = $translation;
-        } else {
+        } elseif (!isset($messages[$singular]['_context'][''])) {
             $messages[$singular]['_context'][''] = $translation;
         }