2015-02-22 18:45:26 -06:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from arrow import locales
|
|
|
|
from arrow.locales import Locale
|
|
|
|
|
|
|
|
def fix():
|
2015-03-15 18:24:15 -06:00
|
|
|
''' This function adds the Catala, Basque and galician locales to the list of locales supported in Arrow.
|
2015-03-17 12:24:29 -06:00
|
|
|
it also fixes capitalizations in names from turkish and arabian locales.
|
|
|
|
see https://github.com/crsmithdev/arrow/pull/207 for following the pull request.'''
|
2015-02-22 18:45:26 -06:00
|
|
|
locales.CatalaLocale = CatalaLocale
|
|
|
|
locales.GalicianLocale = GalicianLocale
|
|
|
|
locales.BasqueLocale = BasqueLocale
|
2015-03-15 18:24:15 -06:00
|
|
|
locales.TurkishLocale.names[-1] = "tr_tr"
|
|
|
|
locales.ArabicLocale.names[-1] = "ar_eg"
|
2015-09-23 10:00:14 -05:00
|
|
|
# insert a modified function so if there is no language available in arrow, returns English locale.
|
|
|
|
locales.get_locale = get_locale
|
2015-02-22 18:45:26 -06:00
|
|
|
# We need to reassign the locales list for updating the list with our new contents.
|
|
|
|
locales._locales = locales._map_locales()
|
|
|
|
|
2015-09-23 10:00:14 -05:00
|
|
|
def get_locale(name):
|
|
|
|
locale_cls = locales._locales.get(name.lower())
|
|
|
|
if locale_cls is None:
|
|
|
|
return locales.EnglishLocale()
|
|
|
|
return locale_cls()
|
|
|
|
|
2015-02-22 18:45:26 -06:00
|
|
|
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}'
|
2015-08-02 00:04:04 +02:00
|
|
|
future = '{0} igarota'
|
2015-02-22 18:45:26 -06:00
|
|
|
|
|
|
|
timeframes = {
|
|
|
|
'now': 'Orain',
|
2015-08-02 00:04:04 +02:00
|
|
|
# 'second': 'segundu bat',
|
|
|
|
'seconds': 'segundu batzuk', # without specifying a number.
|
|
|
|
#'seconds': '{0} segundu', # specifying a number
|
2015-02-22 18:45:26 -06:00
|
|
|
'minute': 'minutu bat',
|
|
|
|
'minutes': '{0} minutu',
|
|
|
|
'hour': 'ordu bat',
|
|
|
|
'hours': '{0} ordu',
|
|
|
|
'day': 'egun bat',
|
|
|
|
'days': '{0} egun',
|
|
|
|
'month': 'hilabete bat',
|
2015-04-08 23:47:50 +02:00
|
|
|
'months': '{0} hilabete',
|
2015-02-22 18:45:26 -06:00
|
|
|
'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']
|
|
|
|
|