From a69bf99c1aa66a3920e931ab922ee9bccd94681d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Wed, 23 Sep 2015 10:00:14 -0500 Subject: [PATCH] If there is no locale for language, use English in arrow --- src/fixes/fix_arrow.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/fixes/fix_arrow.py b/src/fixes/fix_arrow.py index fed25726..74715991 100644 --- a/src/fixes/fix_arrow.py +++ b/src/fixes/fix_arrow.py @@ -11,9 +11,17 @@ def fix(): locales.BasqueLocale = BasqueLocale locales.TurkishLocale.names[-1] = "tr_tr" locales.ArabicLocale.names[-1] = "ar_eg" + # insert a modified function so if there is no language available in arrow, returns English locale. + locales.get_locale = get_locale # We need to reassign the locales list for updating the list with our new contents. locales._locales = locales._map_locales() +def get_locale(name): + locale_cls = locales._locales.get(name.lower()) + if locale_cls is None: + return locales.EnglishLocale() + return locale_cls() + class CatalaLocale(Locale): names = ['ca', 'ca_ca'] past = 'Fa {0}'