removed legacy code from _date_cs.py

fixed inflections in cs.po
This commit is contained in:
Zdeněk Hataš 2017-06-15 12:57:03 +02:00
parent 22fb1ab254
commit 5b0fbf209e
2 changed files with 29 additions and 230 deletions

View File

@ -49,145 +49,15 @@ class DateParserCZ(DateParser):
"""
Converts a text string into a Date object
"""
month_to_int = DateParser.month_to_int
month_to_int["leden"] = 1
month_to_int["ledna"] = 1
month_to_int["lednu"] = 1
month_to_int["led"] = 1
month_to_int["I"] = 1
month_to_int["i"] = 1
month_to_int["únor"] = 2
month_to_int["února"] = 2
month_to_int["únoru"] = 2
month_to_int["ún"] = 2
month_to_int["II"] = 2
month_to_int["ii"] = 2
month_to_int["březen"] = 3
month_to_int["března"] = 3
month_to_int["březnu"] = 3
month_to_int["bře"] = 3
month_to_int["III"] = 3
month_to_int["iii"] = 3
month_to_int["duben"] = 4
month_to_int["dubna"] = 4
month_to_int["dubnu"] = 4
month_to_int["dub"] = 4
month_to_int["IV"] = 4
month_to_int["iv"] = 4
month_to_int["květen"] = 5
month_to_int["května"] = 5
month_to_int["květnu"] = 5
month_to_int["V"] = 5
month_to_int["v"] = 5
month_to_int["červen"] = 6
month_to_int["června"] = 6
month_to_int["červnu"] = 6
month_to_int["čer"] = 6
month_to_int["vi"] = 6
month_to_int["červenec"] = 7
month_to_int["července"] = 7
month_to_int["červenci"] = 7
month_to_int["čvc"] = 7
month_to_int["VII"] = 7
month_to_int["vii"] = 7
month_to_int["srpen"] = 8
month_to_int["srpna"] = 8
month_to_int["srpnu"] = 8
month_to_int["srp"] = 8
month_to_int["VIII"] = 8
month_to_int["viii"] = 8
month_to_int["září"] = 9
month_to_int["zář"] = 9
month_to_int["IX"] = 9
month_to_int["ix"] = 9
month_to_int["říjen"] = 10
month_to_int["října"] = 10
month_to_int["říjnu"] = 10
month_to_int["říj"] = 10
month_to_int["X"] = 10
month_to_int["x"] = 10
month_to_int["listopad"] = 11
month_to_int["listopadu"] = 11
month_to_int["lis"] = 11
month_to_int["XI"] = 11
month_to_int["xi"] = 11
month_to_int["prosinec"] = 12
month_to_int["prosince"] = 12
month_to_int["prosinci"] = 12
month_to_int["pro"] = 12
month_to_int["XII"] = 12
month_to_int["xii"] = 12
modifier_to_int = {
'před' : Date.MOD_BEFORE,
'do' : Date.MOD_BEFORE,
'po' : Date.MOD_AFTER,
'asi' : Date.MOD_ABOUT,
'kolem' : Date.MOD_ABOUT,
'přibl.' : Date.MOD_ABOUT,
}
calendar_to_int = {
'gregoriánský' : Date.CAL_GREGORIAN,
'greg.' : Date.CAL_GREGORIAN,
'g' : Date.CAL_GREGORIAN,
'juliánský' : Date.CAL_JULIAN,
'jul.' : Date.CAL_JULIAN,
'j' : Date.CAL_JULIAN,
'hebrejský' : Date.CAL_HEBREW,
'hebr.' : Date.CAL_HEBREW,
'h' : Date.CAL_HEBREW,
'islámský' : Date.CAL_ISLAMIC,
'isl.' : Date.CAL_ISLAMIC,
'i' : Date.CAL_ISLAMIC,
'francouzský republikánský' : Date.CAL_FRENCH,
'fr.' : Date.CAL_FRENCH,
'perský' : Date.CAL_PERSIAN,
'per.' : Date.CAL_PERSIAN,
'p' : Date.CAL_PERSIAN,
'švédský' : Date.CAL_SWEDISH,
'sve.' : Date.CAL_SWEDISH,
's' : Date.CAL_SWEDISH,
}
quality_to_int = {
'přibližně' : Date.QUAL_ESTIMATED,
'odhadem' : Date.QUAL_ESTIMATED,
'odh.' : Date.QUAL_ESTIMATED,
'vypočteno' : Date.QUAL_CALCULATED,
'vypočtené' : Date.QUAL_CALCULATED,
'vyp.' : Date.QUAL_CALCULATED,
}
bce = ["před naším letopočtem", "před Kristem",
"př. n. l.", "př. Kr."] + DateParser.bce
def dhformat_changed(self):
""" Allow overriding so a subclass can modify it """
# bug 9739 grampslocale.py gets '%-d.%-m.%Y' -- makes it be '%/d.%/m.%Y'
self.dhformat = self.dhformat.replace('/', '') # so counteract that
def init_strings(self):
DateParser.init_strings(self)
self._text2 = re.compile('(\d+)?\.?\s+?%s\.?\s*((\d+)(/\d+)?)?\s*$'
% self._mon_str, re.IGNORECASE)
self._span = re.compile(
"(od)\s+(?P<start>.+)\s+(do)\s+(?P<stop>.+)",
re.IGNORECASE)
self._range = re.compile(
"(mezi)\s+(?P<start>.+)\s+(a)\s+(?P<stop>.+)",
re.IGNORECASE)
#-------------------------------------------------------------------------
#
# Czech display
@ -197,25 +67,6 @@ class DateDisplayCZ(DateDisplay):
"""
Czech language date display class.
"""
long_months = ( "", "leden", "únor", "březen", "duben", "květen",
"červen", "červenec", "srpen", "září", "říjen",
"listopad", "prosinec" )
short_months = ( "", "led", "úno", "bře", "dub", "kvě", "čer",
"čvc", "srp", "zář", "říj", "lis", "pro" )
calendar = (
"", "juliánský", "hebrejský",
"francouzský republikánský", "perský", "islámský",
"švédský"
)
_mod_str = ("", "před ", "po ", "kolem ", "", "", "")
_qual_str = ("", "přibližně ", "vypočteno ")
bce = ["před naším letopočtem", "před Kristem",
"př. n. l.", "př. Kr."] + DateParser.bce
display = DateDisplay.display_formatted
@ -225,58 +76,6 @@ class DateDisplayCZ(DateDisplay):
# bug 9537 grampslocale.py gets '%-d.%-m.%Y' -- makes it be '%/d.%/m.%Y'
self.dhformat = self.dhformat.replace('/', '') # so counteract that
self.formats = (
"ISO (rrrr-mm-dd)",
"numerický",
"měsíc den, Rok",
"měs den, Rok",
"den. měsíc rok",
"den. měs rok"
)
# this must agree with DateDisplayEn's "formats" definition
# (since no locale-specific _display_gregorian exists, here)
def orig_display(self, date): # unused: only here for historical reference
"""
Return a text string representing the date.
"""
mod = date.get_modifier()
cal = date.get_calendar()
qual = date.get_quality()
start = date.get_start_date()
newyear = date.get_new_year()
qual_str = self._qual_str[qual]
if mod == Date.MOD_TEXTONLY:
return date.get_text()
elif start == Date.EMPTY:
return ""
# elif mod == Date.MOD_NONE:
# date_decl_string = self.display_cal[cal](start)
# date_decl_string = date_decl_string.replace("den ", "dna ")
# date_decl_string = date_decl_string.replace("or ", "ora ")
# date_decl_string = date_decl_string.replace("en ", "na ")
# date_decl_string = date_decl_string.replace("ad ", "adu ")
# date_decl_string = date_decl_string.replace("ec ", "ce ")
# return date_decl_string
elif mod == Date.MOD_SPAN:
dat1 = self.display_cal[cal](start)
dat2 = self.display_cal[cal](date.get_stop_date())
scal = self.format_extras(cal, newyear)
return "%s%s %s %s %s%s" % (qual_str, 'od', dat1,
'do', dat2, scal)
elif mod == Date.MOD_RANGE:
dat1 = self.display_cal[cal](start)
dat2 = self.display_cal[cal](date.get_stop_date())
scal = self.format_extras(cal, newyear)
return "%s%s %s %s %s%s" % (qual_str, 'mezi',
dat1, 'a', dat2, scal)
else:
text = self.display_cal[date.get_calendar()](start)
scal = self.format_extras(cal, newyear)
return "%s%s%s%s" % (qual_str, self._mod_str[mod],
text, scal)
#-------------------------------------------------------------------------
#

View File

@ -2239,7 +2239,7 @@ msgstr "{short_month} {year}"
#: ../gramps/gen/datehandler/_datedisplay.py:261
#, python-brace-format
msgid "from|{short_month} {year}"
msgstr "{short_month.f[D]} {year}"
msgstr "{short_month} {year}"
#. second date in a span
#. If "to <Month>" needs a special inflection in your
@ -2249,7 +2249,7 @@ msgstr "{short_month.f[D]} {year}"
#: ../gramps/gen/datehandler/_datedisplay.py:269
#, python-brace-format
msgid "to|{short_month} {year}"
msgstr "{short_month.f[D]} {year}"
msgstr "{short_month} {year}"
#. first date in a range
#. If "between <Month>" needs a special inflection in your
@ -2259,7 +2259,7 @@ msgstr "{short_month.f[D]} {year}"
#: ../gramps/gen/datehandler/_datedisplay.py:277
#, python-brace-format
msgid "between|{short_month} {year}"
msgstr "{short_month.f[O]} {year}"
msgstr "{short_month} {year}"
#. second date in a range
#. If "and <Month>" needs a special inflection in your
@ -2269,7 +2269,7 @@ msgstr "{short_month.f[O]} {year}"
#: ../gramps/gen/datehandler/_datedisplay.py:285
#, python-brace-format
msgid "and|{short_month} {year}"
msgstr "{short_month.f[O]} {year}"
msgstr "{short_month} {year}"
#. If "before <Month>" needs a special inflection in your
#. language, translate this to "{short_month.f[X]} {year}"
@ -2278,7 +2278,7 @@ msgstr "{short_month.f[O]} {year}"
#: ../gramps/gen/datehandler/_datedisplay.py:292
#, python-brace-format
msgid "before|{short_month} {year}"
msgstr "{short_month.f[D]} {year}"
msgstr "{short_month} {year}"
#. If "after <Month>" needs a special inflection in your
#. language, translate this to "{short_month.f[X]} {year}"
@ -2287,7 +2287,7 @@ msgstr "{short_month.f[D]} {year}"
#: ../gramps/gen/datehandler/_datedisplay.py:299
#, python-brace-format
msgid "after|{short_month} {year}"
msgstr "{short_month.f[T]} {year}"
msgstr "{short_month} {year}"
#. If "about <Month>" needs a special inflection in your
#. language, translate this to "{short_month.f[X]} {year}"
@ -2296,7 +2296,7 @@ msgstr "{short_month.f[T]} {year}"
#: ../gramps/gen/datehandler/_datedisplay.py:306
#, python-brace-format
msgid "about|{short_month} {year}"
msgstr "{short_month.f[D]} {year}"
msgstr "{short_month} {year}"
#. If "estimated <Month>" needs a special inflection in your
#. language, translate this to "{short_month.f[X]} {year}"
@ -2473,51 +2473,51 @@ msgstr "P=prosinec|D=prosince|T=prosinci|O=prosincem"
#. DateDisplayer code!
#: ../gramps/gen/datehandler/_datestrings.py:97
msgid "localized lexeme inflections - short month form||Jan"
msgstr "P=led|D=led|T=led"
msgstr "led"
#: ../gramps/gen/datehandler/_datestrings.py:98
msgid "localized lexeme inflections - short month form||Feb"
msgstr "P=úno|D=úno|T=úno"
msgstr "úno"
#: ../gramps/gen/datehandler/_datestrings.py:99
msgid "localized lexeme inflections - short month form||Mar"
msgstr "P=bře|D=bře|T=bře"
msgstr "bře"
#: ../gramps/gen/datehandler/_datestrings.py:100
msgid "localized lexeme inflections - short month form||Apr"
msgstr "P=dub|D=dub|T=dub"
msgstr "dub"
#: ../gramps/gen/datehandler/_datestrings.py:101
msgid "localized lexeme inflections - short month form||May"
msgstr "P=kvě|D=kvě|T=kvě"
msgstr "kvě"
#: ../gramps/gen/datehandler/_datestrings.py:102
msgid "localized lexeme inflections - short month form||Jun"
msgstr "P=čer|D=čer|T=čer"
msgstr "čer"
#: ../gramps/gen/datehandler/_datestrings.py:103
msgid "localized lexeme inflections - short month form||Jul"
msgstr "P=čvc|D=čvc|T=čvc"
msgstr "čvc"
#: ../gramps/gen/datehandler/_datestrings.py:104
msgid "localized lexeme inflections - short month form||Aug"
msgstr "P=srp|D=srp|T=srp"
msgstr "srp"
#: ../gramps/gen/datehandler/_datestrings.py:105
msgid "localized lexeme inflections - short month form||Sep"
msgstr "P=zář|D=zář|T=zář"
msgstr "zář"
#: ../gramps/gen/datehandler/_datestrings.py:106
msgid "localized lexeme inflections - short month form||Oct"
msgstr "P=říj|D=říj|T=říj"
msgstr "říj"
#: ../gramps/gen/datehandler/_datestrings.py:107
msgid "localized lexeme inflections - short month form||Nov"
msgstr "P=lis|D=lis|T=lis"
msgstr "lis"
#: ../gramps/gen/datehandler/_datestrings.py:108
msgid "localized lexeme inflections - short month form||Dec"
msgstr "P=pro|D=pro|T=pro"
msgstr "pro"
#. TRANSLATORS: see
#. http://gramps-project.org/wiki/index.php?title=Translating_Gramps#Translating_dates
@ -2574,31 +2574,31 @@ msgstr "prosinec"
#. Must appear in the order indexed by Date.CAL_... numeric constants
#: ../gramps/gen/datehandler/_datestrings.py:131 ../gramps/gen/lib/date.py:609
msgid "calendar|Gregorian"
msgstr "Gregoriánský"
msgstr "gregoriánský"
#: ../gramps/gen/datehandler/_datestrings.py:132 ../gramps/gen/lib/date.py:610
msgid "calendar|Julian"
msgstr "Juliánský"
msgstr "juliánský"
#: ../gramps/gen/datehandler/_datestrings.py:133 ../gramps/gen/lib/date.py:611
msgid "calendar|Hebrew"
msgstr "Hebrejský"
msgstr "hebrejský"
#: ../gramps/gen/datehandler/_datestrings.py:134 ../gramps/gen/lib/date.py:612
msgid "calendar|French Republican"
msgstr "Francouzské republiky"
msgstr "francouzský republikánský"
#: ../gramps/gen/datehandler/_datestrings.py:135 ../gramps/gen/lib/date.py:613
msgid "calendar|Persian"
msgstr "Perský"
msgstr "perský"
#: ../gramps/gen/datehandler/_datestrings.py:136 ../gramps/gen/lib/date.py:614
msgid "calendar|Islamic"
msgstr "Islámský"
msgstr "islámský"
#: ../gramps/gen/datehandler/_datestrings.py:137 ../gramps/gen/lib/date.py:615
msgid "calendar|Swedish"
msgstr "Švédský"
msgstr "švédský"
#. TRANSLATORS: see
#. http://gramps-project.org/wiki/index.php?title=Translating_Gramps#Translating_dates
@ -17947,7 +17947,7 @@ msgstr "Sloupec %d:"
#: ../gramps/gui/plug/tool.py:55
msgid "Debug"
msgstr "Ladit"
msgstr "Ladění a diagnostika"
#: ../gramps/gui/plug/tool.py:56
msgid "Analysis and Exploration"