Skip to content

Commit

Permalink
Do not enforce 'one' to be provided for pluralization
Browse files Browse the repository at this point in the history
  • Loading branch information
danhper committed Aug 26, 2020
1 parent 769bde4 commit c48ba7c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion i18n/resource_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

loaders = {}

PLURALS = ["zero", "one", "few", "many"]


def register_loader(loader_class, supported_extensions):
if not hasattr(loader_class, "load_resource"):
Expand Down Expand Up @@ -76,7 +78,7 @@ def load_translation_dic(dic, namespace, locale):
if namespace:
namespace += config.get('namespace_delimiter')
for key, value in dic.items():
if type(value) == dict and not ("one" in value and "many" in value):
if type(value) == dict and len(set(PLURALS).intersection(value)) < 2:
load_translation_dic(value, namespace + key, locale)
else:
translations.add(namespace + key, value, locale)
Expand Down

0 comments on commit c48ba7c

Please sign in to comment.