added SVN properties, and SVN Id lines as needed, fixed typos in _Date_ar.py
svn: r22606
This commit is contained in:
@@ -1,322 +1,320 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2004-2006 Donald N. Allingham
|
# Copyright (C) 2004-2006 Donald N. Allingham
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
# $Id: _DateParser.py 18562 2011-12-10 10:04:35Z m_d_n $
|
# $Id$
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Date parsing class. Serves as the base class for any localized
|
Arabic-specific classes for parsing and displaying dates.
|
||||||
date parsing class. The default, base class provides parsing for
|
"""
|
||||||
English.
|
|
||||||
"""
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
#-------------------------------------------------------------------------
|
# Python modules
|
||||||
#
|
#
|
||||||
# Python modules
|
#-------------------------------------------------------------------------
|
||||||
#
|
from __future__ import unicode_literals
|
||||||
#-------------------------------------------------------------------------
|
import re
|
||||||
from __future__ import unicode_literals
|
import calendar
|
||||||
import re
|
|
||||||
import calendar
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
#-------------------------------------------------------------------------
|
# set up logging
|
||||||
#
|
#
|
||||||
# set up logging
|
#-------------------------------------------------------------------------
|
||||||
#
|
import logging
|
||||||
#-------------------------------------------------------------------------
|
log = logging.getLogger(".DateParser")
|
||||||
import logging
|
|
||||||
log = logging.getLogger(".DateParser")
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
#-------------------------------------------------------------------------
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
#-------------------------------------------------------------------------
|
||||||
#
|
from gen.lib import Date
|
||||||
#-------------------------------------------------------------------------
|
from _DateParser import DateParser
|
||||||
from gen.lib import Date
|
from _DateDisplay import DateDisplay
|
||||||
from _DateParser import DateParser
|
from _DateHandler import register_datehandler
|
||||||
from _DateDisplay import DateDisplay
|
|
||||||
from _DateHandler import register_datehandler
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
#-------------------------------------------------------------------------
|
# Arabic parser class
|
||||||
#
|
#
|
||||||
# Arabic parser class
|
#-------------------------------------------------------------------------
|
||||||
#
|
class DateParserAR(DateParser):
|
||||||
#-------------------------------------------------------------------------
|
"""
|
||||||
class DateParserAR(DateParser):
|
Convert a text string into a Date object. If the date cannot be
|
||||||
"""
|
converted, the text string is assigned.
|
||||||
Convert a text string into a Date object. If the date cannot be
|
"""
|
||||||
converted, the text string is assigned.
|
|
||||||
"""
|
|
||||||
|
# modifiers before the date
|
||||||
|
modifier_to_int = {
|
||||||
# modifiers before the date
|
'قبل' : Date.MOD_BEFORE,
|
||||||
modifier_to_int = {
|
'قبل' : Date.MOD_BEFORE,
|
||||||
'قبل' : Date.MOD_BEFORE,
|
'قبل.' : Date.MOD_BEFORE,
|
||||||
'قبل' : Date.MOD_BEFORE,
|
'بعد' : Date.MOD_AFTER,
|
||||||
'قبل.' : Date.MOD_BEFORE,
|
'بعد' : Date.MOD_AFTER,
|
||||||
'بعد' : Date.MOD_AFTER,
|
'بعد.' : Date.MOD_AFTER,
|
||||||
'بعد' : Date.MOD_AFTER,
|
'حوالي' : Date.MOD_ABOUT,
|
||||||
'بعد.' : Date.MOD_AFTER,
|
'حوالي.' : Date.MOD_ABOUT,
|
||||||
'حوالي' : Date.MOD_ABOUT,
|
'حوالي' : Date.MOD_ABOUT,
|
||||||
'حوالي.' : Date.MOD_ABOUT,
|
'حوالي' : Date.MOD_ABOUT,
|
||||||
'حوالي' : Date.MOD_ABOUT,
|
'حوالي.' : Date.MOD_ABOUT,
|
||||||
'حوالي' : Date.MOD_ABOUT,
|
'حوالي' : Date.MOD_ABOUT,
|
||||||
'حوالي.' : Date.MOD_ABOUT,
|
}
|
||||||
'حوالي' : Date.MOD_ABOUT,
|
# in some languages some of above listed modifiers are after the date,
|
||||||
}
|
# in that case the subclass should put them into this dictionary instead
|
||||||
# in some languages some of above listed modifiers are after the date,
|
modifier_after_to_int = {}
|
||||||
# in that case the subclass should put them into this dictionary instead
|
|
||||||
modifier_after_to_int = {}
|
hebrew_to_int = {
|
||||||
|
"tishri" : 1, "heshvan" : 2, "kislev" : 3,
|
||||||
hebrew_to_int = {
|
"tevet" : 4, "shevat" : 5, "adari" : 6,
|
||||||
"tishri" : 1, "heshvan" : 2, "kislev" : 3,
|
"adarii" : 7, "nisan" : 8, "iyyar" : 9,
|
||||||
"tevet" : 4, "shevat" : 5, "adari" : 6,
|
"sivan" : 10, "tammuz" : 11, "av" : 12,
|
||||||
"adarii" : 7, "nisan" : 8, "iyyar" : 9,
|
"elul" : 13,
|
||||||
"sivan" : 10, "tammuz" : 11, "av" : 12,
|
#alternative spelling
|
||||||
"elul" : 13,
|
"cheshvan": 2, "adar sheni": 7, "iyar" : 9,
|
||||||
#alternative spelling
|
}
|
||||||
"cheshvan": 2, "adar sheni": 7, "iyar" : 9,
|
|
||||||
}
|
french_to_int = {
|
||||||
|
'vendémiaire' : 1, 'brumaire' : 2,
|
||||||
french_to_int = {
|
'frimaire' : 3, 'nivôse': 4,
|
||||||
'vendémiaire' : 1, 'brumaire' : 2,
|
'pluviôse' : 5, 'ventôse' : 6,
|
||||||
'frimaire' : 3, 'nivôse': 4,
|
'germinal' : 7, 'floréal' : 8,
|
||||||
'pluviôse' : 5, 'ventôse' : 6,
|
'prairial' : 9, 'messidor' : 10,
|
||||||
'germinal' : 7, 'floréal' : 8,
|
'thermidor' : 11, 'fructidor' : 12,
|
||||||
'prairial' : 9, 'messidor' : 10,
|
'extra' : 13,
|
||||||
'thermidor' : 11, 'fructidor' : 12,
|
#GEDCOM months
|
||||||
'extra' : 13,
|
'vend' : 1, 'brum' : 2,
|
||||||
#GEDCOM months
|
'frim' : 3, 'nivo' : 4,
|
||||||
'vend' : 1, 'brum' : 2,
|
'pluv' : 5, 'vent' : 6,
|
||||||
'frim' : 3, 'nivo' : 4,
|
'germ' : 7, 'flor' : 8,
|
||||||
'pluv' : 5, 'vent' : 6,
|
'prai' : 9, 'mess' : 10,
|
||||||
'germ' : 7, 'flor' : 8,
|
'ther' : 11, 'fruc' : 12,
|
||||||
'prai' : 9, 'mess' : 10,
|
'comp' : 13,
|
||||||
'ther' : 11, 'fruc' : 12,
|
}
|
||||||
'comp' : 13,
|
|
||||||
}
|
islamic_to_int = {
|
||||||
|
"محرّم" : 1, "محرّم الحرام" : 1,
|
||||||
islamic_to_int = {
|
"صفر" : 2, "ربيع الأول" : 3,
|
||||||
"محرّم" : 1, "محرّم الحرام" : 1,
|
"ربيع 1" : 3, "ربيع الأخير" : 4,
|
||||||
"صفر" : 2, "ربيع الأول" : 3,
|
"ربيع الثاني" : 4, "ربيع الثاني" : 4,
|
||||||
"ربيع 1" : 3, "ربيع الأخير" : 4,
|
"ربيع الثاني" : 4, "ربيع الثاني" : 4,
|
||||||
"ربيع الثاني" : 4, "ربيع الثاني" : 4,
|
"ربيع 2" : 4, "جمادى الأولى" : 5,
|
||||||
"ربيع الثاني" : 4, "ربيع الثاني" : 4,
|
"جمادى الأول" : 5, "جمادى 1" : 5,
|
||||||
"ربيع 2" : 4, "جمادى الأولى" : 5,
|
"جمادى الثانية" : 6, "جمادى الأخير" : 6,
|
||||||
"جمادى الأول" : 5, "جمادى 1" : 5,
|
"جمادى الثاني" : 6, "جمادى 2" : 5,
|
||||||
"جمادى الثانية" : 6, "جمادى الأخير" : 6,
|
"رجب" : 7, "شعبان" : 8,
|
||||||
"جمادى الثاني" : 6, "جمادى 2" : 5,
|
"شعبان" : 8, "رمضان" : 9,
|
||||||
"رجب" : 7, "شعبان" : 8,
|
"رمضان" : 9, "شوال" : 10,
|
||||||
"شعبان" : 8, "رمضان" : 9,
|
"ذو القعدة" : 11, "ذو القعدة" : 11,
|
||||||
"رمضان" : 9, "شوال" : 10,
|
"ذو القعدة" : 11, "ذو الحجة" : 12,
|
||||||
"ذو القعدة" : 11, "ذو القعدة" : 11,
|
"ذو الحجة" : 12, "ذو الحجة" : 12,
|
||||||
"ذو القعدة" : 11, "ذو الحجة" : 12,
|
}
|
||||||
"ذو الحجة" : 12, "ذو الحجة" : 12,
|
|
||||||
}
|
persian_to_int = {
|
||||||
|
"farvardin" : 1, "ordibehesht" : 2,
|
||||||
persian_to_int = {
|
"khordad" : 3, "tir" : 4,
|
||||||
"farvardin" : 1, "ordibehesht" : 2,
|
"mordad" : 5, "shahrivar" : 6,
|
||||||
"khordad" : 3, "tir" : 4,
|
"mehr" : 7, "aban" : 8,
|
||||||
"mordad" : 5, "shahrivar" : 6,
|
"azar" : 9, "dey" : 10,
|
||||||
"mehr" : 7, "aban" : 8,
|
"bahman" : 11, "esfand" : 12,
|
||||||
"azar" : 9, "dey" : 10,
|
}
|
||||||
"bahman" : 11, "esfand" : 12,
|
|
||||||
}
|
swedish_to_int = {
|
||||||
|
"januari" : 1, "februari" : 2,
|
||||||
swedish_to_int = {
|
"mars" : 3, "april" : 4,
|
||||||
"januari" : 1, "februari" : 2,
|
"maj" : 5, "juni" : 6,
|
||||||
"mars" : 3, "april" : 4,
|
"juli" : 7, "augusti" : 8,
|
||||||
"maj" : 5, "juni" : 6,
|
"september" : 9, "oktober" : 10,
|
||||||
"juli" : 7, "augusti" : 8,
|
"november" : 11, "december" : 12,
|
||||||
"september" : 9, "oktober" : 10,
|
}
|
||||||
"november" : 11, "december" : 12,
|
|
||||||
}
|
|
||||||
|
bce = ["قبل الميلاد", "قبل الميلاد", "قبل الميلاد", "قبل الميلاد", "قبل الميلاد", "قبل الميلاد" ]
|
||||||
|
|
||||||
bce = ["قبل الميلاد", "قبل الميلاد", "قبل الميلاد", "قبل الميلاد", "قبل الميلاد", "قبل الميلاد" ]
|
calendar_to_int = {
|
||||||
|
'غريغوري' : Date.CAL_GREGORIAN,
|
||||||
calendar_to_int = {
|
'غريغوري' : Date.CAL_GREGORIAN,
|
||||||
'غريغوري' : Date.CAL_GREGORIAN,
|
'يوليوسي' : Date.CAL_JULIAN,
|
||||||
'غريغوري' : Date.CAL_GREGORIAN,
|
'يوليوسي' : Date.CAL_JULIAN,
|
||||||
'يوليوسي' : Date.CAL_JULIAN,
|
'عبري' : Date.CAL_HEBREW,
|
||||||
'يوليوسي' : Date.CAL_JULIAN,
|
'عبري' : Date.CAL_HEBREW,
|
||||||
'عبري' : Date.CAL_HEBREW,
|
'إسلامي' : Date.CAL_ISLAMIC,
|
||||||
'عبري' : Date.CAL_HEBREW,
|
'إسلامي' : Date.CAL_ISLAMIC,
|
||||||
'إسلامي' : Date.CAL_ISLAMIC,
|
'فرنسي' : Date.CAL_FRENCH,
|
||||||
'إسلامي' : Date.CAL_ISLAMIC,
|
'فرنسي جمهوري': Date.CAL_FRENCH,
|
||||||
'فرنسي' : Date.CAL_FRENCH,
|
'فرنسي' : Date.CAL_FRENCH,
|
||||||
'فرنسي جمهوري': Date.CAL_FRENCH,
|
'فارسي' : Date.CAL_PERSIAN,
|
||||||
'فرنسي' : Date.CAL_FRENCH,
|
'فارسي' : Date.CAL_PERSIAN,
|
||||||
'فارسي' : Date.CAL_PERSIAN,
|
'سويدي' : Date.CAL_SWEDISH,
|
||||||
'فارسي' : Date.CAL_PERSIAN,
|
'سويدي' : Date.CAL_SWEDISH,
|
||||||
'سويدي' : Date.CAL_SWEDISH,
|
}
|
||||||
'سويدي' : Date.CAL_SWEDISH,
|
|
||||||
}
|
quality_to_int = {
|
||||||
|
'متوقع' : Date.QUAL_ESTIMATED,
|
||||||
quality_to_int = {
|
'متوقع.' : Date.QUAL_ESTIMATED,
|
||||||
'متوقع' : Date.QUAL_ESTIMATED,
|
'متوقع' : Date.QUAL_ESTIMATED,
|
||||||
'متوقع.' : Date.QUAL_ESTIMATED,
|
'محسوب.' : Date.QUAL_CALCULATED,
|
||||||
'متوقع' : Date.QUAL_ESTIMATED,
|
'محسوب' : Date.QUAL_CALCULATED,
|
||||||
'محسوب.' : Date.QUAL_CALCULATED,
|
'محسوب' : Date.QUAL_CALCULATED,
|
||||||
'محسوب' : Date.QUAL_CALCULATED,
|
}
|
||||||
'محسوب' : Date.QUAL_CALCULATED,
|
|
||||||
}
|
def init_strings(self):
|
||||||
|
"""
|
||||||
def init_strings(self):
|
This method compiles regular expression strings for matching dates.
|
||||||
"""
|
|
||||||
This method compiles regular expression strings for matching dates.
|
Most of the re's in most languages can stay as is. span and range
|
||||||
|
most likely will need to change. Whatever change is done, this method
|
||||||
Most of the re's in most languages can stay as is. span and range
|
may be called first as DateParser.init_strings(self) so that the
|
||||||
most likely will need to change. Whatever change is done, this method
|
invariant expresions don't need to be repeteadly coded. All differences
|
||||||
may be called first as DateParser.init_strings(self) so that the
|
can be coded after DateParser.init_strings(self) call, that way they
|
||||||
invariant expresions don't need to be repeteadly coded. All differences
|
override stuff from this method. See DateParserRU() as an example.
|
||||||
can be coded after DateParser.init_strings(self) call, that way they
|
"""
|
||||||
override stuff from this method. See DateParserRU() as an example.
|
|
||||||
"""
|
DateParser.init_strings(self)
|
||||||
|
# In the following you should translate from and to as in a date
|
||||||
DateParser.init_strings(self)
|
# from 2001 to 2004 and then test if it works for LTR
|
||||||
# In the following you should translate from and to as in a date
|
self._span = re.compile("من\s+(?P<start>.+)\s+إلى\s+(?P<stop>.+)",
|
||||||
# from 2001 to 2004 and then test if it works for LTR
|
re.IGNORECASE)
|
||||||
self._span = re.compile("من\s+(?P<start>.+)\s+إلى\s+(?P<stop>.+)",
|
# In following you must translate bet|bet.|between and 'and' as in a
|
||||||
re.IGNORECASE)
|
# date between 2001 and 2002
|
||||||
# In following you must translate bet|bet.|between and 'and' as in a
|
# Here you see between can be written in 3 different ways, you
|
||||||
# date between 2001 and 2002
|
#can allow the same in arabic
|
||||||
# Here you see between can be written in 3 different ways, you
|
self._range = re.compile("بين\s+(?P<start>.+)\s+و\s+(?P<stop>.+)",
|
||||||
#can allow the same in arabic
|
re.IGNORECASE)
|
||||||
self._range = re.compile("بين\s+(?P<start>.+)\s+و\s+(?P<stop>.+)",
|
|
||||||
re.IGNORECASE)
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
#-------------------------------------------------------------------------
|
# Arabic display
|
||||||
#
|
#
|
||||||
# Italian display
|
#-------------------------------------------------------------------------
|
||||||
#
|
class DateDisplayAR(DateDisplay):
|
||||||
#-------------------------------------------------------------------------
|
"""
|
||||||
class DateDisplayAR(DateDisplay):
|
Arabic language date display class.
|
||||||
"""
|
"""
|
||||||
Italian language date display class.
|
# this is used to display the 12 gregorian months
|
||||||
"""
|
long_months = ( "", "كانون الثاني", "شباط", "آذار", "نيسان", "أيار",
|
||||||
# this is used to display the 12 gregorian months
|
"حزيران", "تموز", "آب", "أيلول", "تشرين الأول",
|
||||||
long_months = ( "", "كانون الثاني", "شباط", "آذار", "نيسان", "أيار",
|
"تشرين الثاني", "كانون الأول" )
|
||||||
"حزيران", "تموز", "آب", "أيلول", "تشرين الأول",
|
|
||||||
"تشرين الثاني", "كانون الأول" )
|
short_months = ( "", "كانون2", "شباط", "آذار", "نيسان", "أيار", "حزيران",
|
||||||
|
"تموز", "آب", "أيلول", "تشرين1", "تشرين2", "كانون1" )
|
||||||
short_months = ( "", "كانون2", "شباط", "آذار", "نيسان", "أيار", "حزيران",
|
|
||||||
"تموز", "آب", "أيلول", "تشرين1", "تشرين2", "كانون1" )
|
#Hebrew months - don't translate if not needed
|
||||||
|
hebrew = (
|
||||||
#Hebrew months - don't translate if not needed
|
"", "Tishri", "Heshvan", "Kislev", "Tevet", "Shevat",
|
||||||
hebrew = (
|
"AdarI", "AdarII", "Nisan", "Iyyar", "Sivan", "Tammuz",
|
||||||
"", "Tishri", "Heshvan", "Kislev", "Tevet", "Shevat",
|
"Av", "Elul"
|
||||||
"AdarI", "AdarII", "Nisan", "Iyyar", "Sivan", "Tammuz",
|
)
|
||||||
"Av", "Elul"
|
#french republican months - don't translate if not needed
|
||||||
)
|
french = (
|
||||||
#french republican months - don't translate if not needed
|
'',
|
||||||
french = (
|
"Vendémiaire",
|
||||||
'',
|
'Brumaire',
|
||||||
"Vendémiaire",
|
'Frimaire',
|
||||||
'Brumaire',
|
"Nivôse",
|
||||||
'Frimaire',
|
"Pluviôse",
|
||||||
"Nivôse",
|
"Ventôse",
|
||||||
"Pluviôse",
|
'Germinal',
|
||||||
"Ventôse",
|
"Floréal",
|
||||||
'Germinal',
|
'Prairial',
|
||||||
"Floréal",
|
'Messidor',
|
||||||
'Prairial',
|
'Thermidor',
|
||||||
'Messidor',
|
'Fructidor',
|
||||||
'Thermidor',
|
'Extra',
|
||||||
'Fructidor',
|
)
|
||||||
'Extra',
|
|
||||||
)
|
persian = (
|
||||||
|
"", "Farvardin", "Ordibehesht", "Khordad", "Tir",
|
||||||
persian = (
|
"Mordad", "Shahrivar", "Mehr", "Aban", "Azar",
|
||||||
"", "Farvardin", "Ordibehesht", "Khordad", "Tir",
|
"Dey", "Bahman", "Esfand"
|
||||||
"Mordad", "Shahrivar", "Mehr", "Aban", "Azar",
|
)
|
||||||
"Dey", "Bahman", "Esfand"
|
|
||||||
)
|
islamic = (
|
||||||
|
"", "محرّم", "صفر", "ربيع الأول", "ربيع الثاني",
|
||||||
islamic = (
|
"جمادى الأولى", "جمادى الثانية", "رجب", "شعبان",
|
||||||
"", "محرّم", "صفر", "ربيع الأول", "ربيع الثاني",
|
"رمضان", "شوال", "ذو القعدة", "ذو الحجة"
|
||||||
"جمادى الأولى", "جمادى الثانية", "رجب", "شعبان",
|
)
|
||||||
"رمضان", "شوال", "ذو القعدة", "ذو الحجة"
|
|
||||||
)
|
swedish = (
|
||||||
|
"", "Januari", "Februari", "Mars",
|
||||||
swedish = (
|
"April", "Maj", "Juni",
|
||||||
"", "Januari", "Februari", "Mars",
|
"Juli", "Augusti", "September",
|
||||||
"April", "Maj", "Juni",
|
"Oktober", "November", "December"
|
||||||
"Juli", "Augusti", "September",
|
)
|
||||||
"Oktober", "November", "December"
|
|
||||||
)
|
#Following are the formats for date display you can set in the preferences
|
||||||
|
formats = (
|
||||||
#Following are the formats for date display you can set in the preferences
|
"YYYY-MM-DD (قياسي)", "عددي", "شهر يوم, سنة",
|
||||||
formats = (
|
"شهر يوم, سنة", "يوم شهر سنة", "يوم شهر سنة"
|
||||||
"YYYY-MM-DD (قياسي)", "عددي", "شهر يوم, سنة",
|
)
|
||||||
"شهر يوم, سنة", "يوم شهر سنة", "يوم شهر سنة"
|
|
||||||
)
|
calendar = (
|
||||||
|
"", "يوليوسي", "عبري", "فرنسي",
|
||||||
calendar = (
|
"فارسي", "إسلامي", "سويدي"
|
||||||
"", "يوليوسي", "عبري", "فرنسي",
|
)
|
||||||
"فارسي", "إسلامي", "سويدي"
|
|
||||||
)
|
_mod_str = ("", "قبل ", "بعد ", "حوالي ", "", "", "")
|
||||||
|
|
||||||
_mod_str = ("", "قبل ", "بعد ", "حوالي ", "", "", "")
|
_qual_str = ("", "متوقع ", "محسوب ")
|
||||||
|
|
||||||
_qual_str = ("", "متوقع ", "محسوب ")
|
_bce_str = "%s قبل الميلاد."
|
||||||
|
|
||||||
_bce_str = "%s قبل الميلاد."
|
def display(self, date):
|
||||||
|
"""
|
||||||
def display(self, date):
|
Return a text string representing the date.
|
||||||
"""
|
"""
|
||||||
Return a text string representing the date.
|
mod = date.get_modifier()
|
||||||
"""
|
cal = date.get_calendar()
|
||||||
mod = date.get_modifier()
|
qual = date.get_quality()
|
||||||
cal = date.get_calendar()
|
start = date.get_start_date()
|
||||||
qual = date.get_quality()
|
newyear = date.get_new_year()
|
||||||
start = date.get_start_date()
|
|
||||||
newyear = date.get_new_year()
|
qual_str = self._qual_str[qual]
|
||||||
|
|
||||||
qual_str = self._qual_str[qual]
|
if mod == Date.MOD_TEXTONLY:
|
||||||
|
return date.get_text()
|
||||||
if mod == Date.MOD_TEXTONLY:
|
elif start == Date.EMPTY:
|
||||||
return date.get_text()
|
return ""
|
||||||
elif start == Date.EMPTY:
|
elif mod == Date.MOD_SPAN:
|
||||||
return ""
|
d1 = self.display_cal[cal](start)
|
||||||
elif mod == Date.MOD_SPAN:
|
d2 = self.display_cal[cal](date.get_stop_date())
|
||||||
d1 = self.display_cal[cal](start)
|
scal = self.format_extras(cal, newyear)
|
||||||
d2 = self.display_cal[cal](date.get_stop_date())
|
# translate from and to
|
||||||
scal = self.format_extras(cal, newyear)
|
return "%s%s %s %s %s%s" % (qual_str, 'من', d1, 'إلى', d2, scal)
|
||||||
# translate from and to
|
elif mod == Date.MOD_RANGE:
|
||||||
return "%s%s %s %s %s%s" % (qual_str, 'من', d1, 'إلى', d2, scal)
|
d1 = self.display_cal[cal](start)
|
||||||
elif mod == Date.MOD_RANGE:
|
d2 = self.display_cal[cal](date.get_stop_date())
|
||||||
d1 = self.display_cal[cal](start)
|
scal = self.format_extras(cal, newyear)
|
||||||
d2 = self.display_cal[cal](date.get_stop_date())
|
# translate between and and
|
||||||
scal = self.format_extras(cal, newyear)
|
return "%s%s %s %s %s%s" % (qual_str, 'بين', d1, 'و', d2, scal)
|
||||||
# translate between and and
|
else:
|
||||||
return "%s%s %s %s %s%s" % (qual_str, 'بين', d1, 'و', d2, scal)
|
text = self.display_cal[date.get_calendar()](start)
|
||||||
else:
|
scal = self.format_extras(cal, newyear)
|
||||||
text = self.display_cal[date.get_calendar()](start)
|
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text, scal)
|
||||||
scal = self.format_extras(cal, newyear)
|
|
||||||
return "%s%s%s%s" % (qual_str, self._mod_str[mod], text, scal)
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
#-------------------------------------------------------------------------
|
# Register classes
|
||||||
#
|
#
|
||||||
# Register classes
|
#-------------------------------------------------------------------------
|
||||||
#
|
register_datehandler(('ar_AR', 'ar', 'Arabic', 'arabic'),
|
||||||
#-------------------------------------------------------------------------
|
DateParserAR, DateDisplayAR)
|
||||||
register_datehandler(('ar_AR', 'ar', 'Arabic', 'arabic'),
|
|
||||||
DateParserAR, DateDisplayAR)
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
# $Id: _Date_uk.py 18361 2011-10-23 03:13:50Z paul-franklin $
|
# $Id$
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Ukrainian-specific classes for parsing and displaying dates.
|
Ukrainian-specific classes for parsing and displaying dates.
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
# $Id: _hascitation.py 20271 2012-08-27 09:39:02Z bmcage $
|
# $Id$
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Filter rule to match citation data.
|
Filter rule to match citation data.
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
# $Id: _HasSourceOf.py 18548 2011-12-04 17:09:17Z kulath $
|
# $Id$
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
# $Id: _HasCitation.py 18548 2011-12-04 17:09:17Z kulath $
|
# $Id$
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Filter rule to match persons with a particular citation.
|
Filter rule to match persons with a particular citation.
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
# $Id: _HasSourceCount.py 18548 2011-12-04 17:09:17Z kulath $
|
# $Id$
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
# $Id: _HasSourceOf.py 18548 2011-12-04 17:09:17Z kulath $
|
# $Id$
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
# Filters/Rules/Person/_MatchesSourceConfidence.py
|
# Filters/Rules/Person/_MatchesSourceConfidence.py
|
||||||
# $Id: _MatchesSourceConfidence.py 18361 2011-10-23 03:13:50Z paul-franklin $
|
# $Id$
|
||||||
#
|
#
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
# $Id: _HasCitation.py 18548 2011-12-04 17:09:17Z kulath $
|
# $Id$
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Filter rule to match family with a particular citation.
|
Filter rule to match family with a particular citation.
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
# $Id: _HasSourceCount.py 18548 2011-12-04 17:09:17Z kulath $
|
# $Id$
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
# $Id: _HasSourceOf.py 18548 2011-12-04 17:09:17Z kulath $
|
# $Id$
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
# Filters/Rules/Person/_MatchesSourceConfidence.py
|
# Filters/Rules/Person/_MatchesSourceConfidence.py
|
||||||
# $Id: _MatchesSourceConfidence.py 18361 2011-10-23 03:13:50Z paul-franklin $
|
# $Id$
|
||||||
#
|
#
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
# $Id: _HasSourceOf.py 18548 2011-12-04 17:09:17Z kulath $
|
# $Id$
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -21,6 +21,9 @@
|
|||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
# src/plugins/rel/rel_uk.py
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
# UA: Пояснення щодо родинних відносин див. relationship.py
|
# UA: Пояснення щодо родинних відносин див. relationship.py
|
||||||
# EN: Ukrainian relationship calculator. For more information see relationship.py
|
# EN: Ukrainian relationship calculator. For more information see relationship.py
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user