`makemessages` command should not remove plurals.

This commit is contained in:
Umair Khan 2016-07-08 15:06:08 +05:00 committed by Tim Abbott
parent 1a9a630526
commit cdf2664030
1 changed files with 7 additions and 0 deletions

View File

@ -209,6 +209,13 @@ class Command(makemessages.Command):
k = k.replace('\\n', '\n') k = k.replace('\\n', '\n')
new_strings[k] = old_strings.get(k, k) new_strings[k] = old_strings.get(k, k)
plurals = {k: v for k, v in old_strings.items() if k.endswith('_plural')}
for plural_key, value in plurals.items():
components = plural_key.split('_')
singular_key = '_'.join(components[:-1])
if singular_key in new_strings:
new_strings[plural_key] = value
return new_strings return new_strings
def write_translation_strings(self, translation_strings): def write_translation_strings(self, translation_strings):