mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Removed translations for arrow. Fixed get_locale
This commit is contained in:
parent
da6eb34500
commit
e06ccacda1
@ -3,23 +3,16 @@ from arrow import locales
|
||||
from arrow.locales import Locale
|
||||
|
||||
def fix():
|
||||
''' This function adds the Catala, Basque and galician locales to the list of locales supported in Arrow.
|
||||
it also fixes capitalizations in names from turkish and arabian locales.
|
||||
see https://github.com/crsmithdev/arrow/pull/207 for following the pull request.'''
|
||||
locales.CatalaLocale = CatalaLocale
|
||||
locales.GalicianLocale = GalicianLocale
|
||||
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()
|
||||
name = name[:2]
|
||||
locale_cls = locales._locales.get(name.lower())
|
||||
if locale_cls == None:
|
||||
return locales.EnglishLocale()
|
||||
return locale_cls()
|
||||
|
||||
class CatalaLocale(Locale):
|
||||
|
Loading…
Reference in New Issue
Block a user