From 35f70e050afcb43f09b00b7c2edaa68f3e53d9df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Sun, 22 Feb 2015 18:45:26 -0600 Subject: [PATCH] Fixed locales in arrow for Catala and Basque (Galician is pending) --- src/fixes/__init__.py | 6 +++ src/fixes/fix_arrow.py | 87 ++++++++++++++++++++++++++++++++++++++++++ src/main.py | 2 + 3 files changed, 95 insertions(+) create mode 100644 src/fixes/__init__.py create mode 100644 src/fixes/fix_arrow.py diff --git a/src/fixes/__init__.py b/src/fixes/__init__.py new file mode 100644 index 00000000..ab2e9a65 --- /dev/null +++ b/src/fixes/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +""" This module contains some bugfixes for packages used in TWBlue. We will make pull requests to the source code of these packages.""" +import fix_arrow # A few new locales for Three languages in arrow. + +def setup(): + fix_arrow.fix() \ No newline at end of file diff --git a/src/fixes/fix_arrow.py b/src/fixes/fix_arrow.py new file mode 100644 index 00000000..7d8c71d4 --- /dev/null +++ b/src/fixes/fix_arrow.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- +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''' + locales.CatalaLocale = CatalaLocale + locales.GalicianLocale = GalicianLocale + locales.BasqueLocale = BasqueLocale + # We need to reassign the locales list for updating the list with our new contents. + locales._locales = locales._map_locales() + +class CatalaLocale(Locale): + names = ['ca', 'ca_ca'] + past = 'Fa {0}' + future = '{0}' # I don't know what's the right phrase in catala for the future. + + timeframes = { + 'now': 'Ara mateix', + 'seconds': 'segons', + 'minute': '1 minut', + 'minutes': '{0} minuts', + 'hour': 'una hora', + 'hours': '{0} hores', + 'day': 'un dia', + 'days': '{0} dies', + 'month': 'un mes', + 'months': '{0} messos', + 'year': 'un any', + 'years': '{0} anys', + } + + month_names = ['', 'Jener', 'Febrer', 'Març', 'Abril', 'Maig', 'Juny', 'Juliol', 'Agost', 'Setembre', 'Octubre', 'Novembre', 'Decembre'] + month_abbreviations = ['', 'Jener', 'Febrer', 'Març', 'Abril', 'Maig', 'Juny', 'Juliol', 'Agost', 'Setembre', 'Octubre', 'Novembre', 'Decembre'] + day_names = ['', 'Dilluns', 'Dimars', 'Dimecres', 'Dijous', 'Divendres', 'Disabte', 'Diumenge'] + day_abbreviations = ['', 'Dilluns', 'Dimars', 'Dimecres', 'Dijous', 'Divendres', 'Disabte', 'Diumenge'] + +class GalicianLocale(Locale): + names = ['gl', 'gl_gl'] + past = 'Fai {0}' + future = '{0}' # I don't know what's the right phrase in Galician for the future. + + timeframes = { + 'now': 'Agora mesmo', + 'seconds': 'segundos', + 'minute': 'un minuto', + 'minutes': '{0} minutos', + 'hour': 'una hora', + 'hours': '{0} horas', + 'day': 'un día', + 'days': '{0} días', + 'month': 'un mes', + 'months': '{0} meses', + 'year': 'un ano', + 'years': '{0} anos', + } + + month_names = ['', 'Xaneiro', 'Febreiro', 'Marzo', 'Abril', 'Maio', 'Xuño', 'Xullo', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Decembro'] + month_abbreviations = ['', 'Xan', 'Feb', 'Mar', 'Abr', 'Mai', 'Xun', 'Xul', 'Ago', 'Set', 'Out', 'Nov', 'Dec'] + day_names = ['', 'Luns', 'Martes', 'Mércores', 'Xoves', 'Venres', 'Sábado', 'Domingo'] + day_abbreviations = ['', 'Lun', 'Mar', 'Mer', 'xov', 'Ven' 'Sab', 'Dom'] + +class BasqueLocale(Locale): + names = ['eu', 'eu_eu'] + past = 'duela {0}' + future = '{0}' # I don't know what's the right phrase in Basque for the future. + + timeframes = { + 'now': 'Orain', + 'seconds': 'segundu', + 'minute': 'minutu bat', + 'minutes': '{0} minutu', + 'hour': 'ordu bat', + 'hours': '{0} ordu', + 'day': 'egun bat', + 'days': '{0} egun', + 'month': 'hilabete bat', + 'months': '{0} hilabet', + 'year': 'urte bat', + 'years': '{0} urte', + } + + month_names = ['', 'Urtarrilak', 'Otsailak', 'Martxoak', 'Apirilak', 'Maiatzak', 'Ekainak', 'Uztailak', 'Abuztuak', 'Irailak', 'Urriak', 'Azaroak', 'Abenduak'] + month_abbreviations = ['', 'urt', 'ots', 'mar', 'api', 'mai', 'eka', 'uzt', 'abu', 'ira', 'urr', 'aza', 'abe'] + day_names = ['', 'Asteleehna', 'Asteartea', 'Asteazkena', 'Osteguna', 'Ostirala', 'Larunbata', 'Igandea'] + day_abbreviations = ['', 'al', 'ar', 'az', 'og', 'ol', 'lr', 'ig'] + diff --git a/src/main.py b/src/main.py index 74437440..c44a65a3 100644 --- a/src/main.py +++ b/src/main.py @@ -13,6 +13,7 @@ import application import keys from mysc.thread_utils import call_threaded from update import updater +import fixes log = logging.getLogger("main") def setup(): @@ -35,6 +36,7 @@ def setup(): else: sm.do_ok() del sm + fixes.setup() r = mainController.Controller() r.view.Show() r.do_work()