update Slovenian files

svn: r15752
This commit is contained in:
Jérôme Rapinat 2010-08-16 12:23:56 +00:00
parent 6a26f7b873
commit 94f0d17c8b
5 changed files with 21754 additions and 20572 deletions

41662
po/sl.po

File diff suppressed because it is too large Load Diff

313
src/DateHandler/_Date_sl.py Normal file
View File

@ -0,0 +1,313 @@
# -*- coding: utf-8 -*-
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2004-2007 Donald N. Allingham
#
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Slovenian version 2010 by Bernard Banko, based on croatian one by Josip
"""
Slovenian-specific classes for parsing and displaying dates.
"""
#-------------------------------------------------------------------------
#
# Python modules
#
#-------------------------------------------------------------------------
import re
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
#-------------------------------------------------------------------------
#
# Slovenian parser
#
#-------------------------------------------------------------------------
class DateParserSL(DateParser):
"""
Converts a text string into a Date object
"""
month_to_int = DateParser.month_to_int
month_to_int[u"januar"] = 1
month_to_int[u"januarja"] = 1
month_to_int[u"januarjem"] = 1
month_to_int[u"jan"] = 1
month_to_int[u"i"] = 1
month_to_int[u"februar"] = 2
month_to_int[u"februarjem"] = 2
month_to_int[u"februarja"] = 2
month_to_int[u"feb"] = 2
month_to_int[u"ii"] = 2
month_to_int[u"mar"] = 3
month_to_int[u"marcem"] = 3
month_to_int[u"marec"] = 3
month_to_int[u"marca"] = 3
month_to_int[u"iii"] = 3
month_to_int[u"apr"] = 4
month_to_int[u"april"] = 4
month_to_int[u"aprilom"] = 4
month_to_int[u"aprila"] = 4
month_to_int[u"iv"] = 4
month_to_int[u"maj"] = 5
month_to_int[u"maja"] = 5
month_to_int[u"majem"] = 5
month_to_int[u"v"] = 5
month_to_int[u"jun"] = 6
month_to_int[u"junij"] = 6
month_to_int[u"junijem"] = 6
month_to_int[u"junija"] = 6
month_to_int[u"vi"] = 6
month_to_int[u"jul"] = 7
month_to_int[u"julij"] = 7
month_to_int[u"julijem"] = 7
month_to_int[u"julija"] = 7
month_to_int[u"vii"] = 7
month_to_int[u"avg"] = 8
month_to_int[u"avgust"] = 8
month_to_int[u"avgustom"] = 8
month_to_int[u"avgusta"] = 8
month_to_int[u"viii"] = 8
month_to_int[u"sep"] = 9
month_to_int[u"sept"] = 9
month_to_int[u"september"] = 9
month_to_int[u"septembrom"] = 9
month_to_int[u"septembra"] = 9
month_to_int[u"ix"] = 9
month_to_int[u"okt"] = 10
month_to_int[u"oktober"] = 10
month_to_int[u"oktobrom"] = 10
month_to_int[u"oktobra"] = 10
month_to_int[u"x"] = 10
month_to_int[u"nov"] = 11
month_to_int[u"november"] = 11
month_to_int[u"novembrom"] = 11
month_to_int[u"novembra"] = 11
month_to_int[u"xi"] = 11
month_to_int[u"dec"] = 12
month_to_int[u"december"] = 12
month_to_int[u"decembrom"] = 12
month_to_int[u"decembra"] = 12
month_to_int[u"xii"] = 12
modifier_to_int = {
u'pred' : Date.MOD_BEFORE,
u'pr.' : Date.MOD_BEFORE,
u'po' : Date.MOD_AFTER,
u'okoli' : Date.MOD_ABOUT,
u'okrog' : Date.MOD_ABOUT,
u'okr.' : Date.MOD_ABOUT,
u'ok.' : Date.MOD_ABOUT,
u'cca.' : Date.MOD_ABOUT,
u'cca' : Date.MOD_ABOUT,
u'circa' : Date.MOD_ABOUT,
u'ca.' : Date.MOD_ABOUT,
}
calendar_to_int = {
u'gregorijanski' : Date.CAL_GREGORIAN,
u'greg.' : Date.CAL_GREGORIAN,
u'julijanski' : Date.CAL_JULIAN,
u'jul.' : Date.CAL_JULIAN,
u'hebrejski' : Date.CAL_HEBREW,
u'hebr.' : Date.CAL_HEBREW,
u'islamski' : Date.CAL_ISLAMIC,
u'isl.' : Date.CAL_ISLAMIC,
u'francoski republikanski': Date.CAL_FRENCH,
u'franc.' : Date.CAL_FRENCH,
u'perzijski' : Date.CAL_PERSIAN,
u'perz. ' : Date.CAL_PERSIAN,
u'švedski' : Date.CAL_SWEDISH,
u'šved.' : Date.CAL_SWEDISH,
}
quality_to_int = {
u'približno' : Date.QUAL_ESTIMATED,
u'pribl.' : Date.QUAL_ESTIMATED,
u'izračunano' : Date.QUAL_CALCULATED,
u'izrač.' : Date.QUAL_CALCULATED,
}
bce = ["pred našim štetjem", "pred Kristusom",
"p.n.š.", "p. n. š.", "pr.Kr.", "pr. Kr."] + DateParser.bce
def init_strings(self):
"""
compiles regular expression strings for matching dates
"""
DateParser.init_strings(self)
# match 'Day. MONTH year.' format with or without dots
self._text2 = re.compile('(\d+)?\.?\s*?%s\.?\s*((\d+)(/\d+)?)?\s*\.?$'
% self._mon_str, re.IGNORECASE)
# match Day.Month.Year.
self._numeric = re.compile("((\d+)[/\.-])?\s*((\d+)[/\.-])?\s*(\d+)\.?$")
self._span = re.compile("od\s+(?P<start>.+)\s+do\s+(?P<stop>.+)",
re.IGNORECASE)
self._range = re.compile(
u"med\s+(?P<start>.+)\s+in\s+(?P<stop>.+)",
re.IGNORECASE)
self._jtext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?'\
% self._jmon_str, re.IGNORECASE)
#-------------------------------------------------------------------------
#
# Slovenian display
#
#-------------------------------------------------------------------------
class DateDisplaySL(DateDisplay):
"""
Slovenian language date display class.
"""
long_months = ( u"", u"januarja", u"februarja", u"marca",u"aprila",
u"maja", u"junija", u"julija", u"avgusta", u"septembra",
u"oktobra", u"novembra", u"decembra"
)
short_months = ( u"", u"jan", u"feb", u"mar", u"apr", u"maj", u"jun",
u"jul", u"avg", u"sep", u"okt", u"nov", u"dec"
)
calendar = (
"", u"julijanski", u"hebrejski",
u"francoski republikanski", u"perzijski", u"islamski",
u"švedski"
)
_mod_str = ("", "pred ", "po ", "okrog ", "", "", "")
_qual_str = ("", "približno ", "izračunano ")
_bce_str = "%s p.n.š."
formats = (
"ISO (leto-mm-dd)",
"številčno",
"dan. mes. leto",
"dan. mesec leto"
)
def _display_gregorian(self, date_val):
"""
display gregorian calendar date in different format
"""
year = self._slash_year(date_val[2], date_val[3])
if self.format == 0:
return self.display_iso(date_val)
elif self.format == 1:
# D. M. YYYY
if date_val[3]:
return self.display_iso(date_val)
else:
if date_val[0] == 0 and date_val[1] == 0:
value = str(date_val[2])
else:
value = self._tformat.replace('%m', str(date_val[1]))
value = value.replace('%d', str(date_val[0]))
value = value.replace('%Y', str(date_val[2]))
value = value.replace('-', '. ')
elif self.format == 2:
# D. mon. YYYY
if date_val[0] == 0:
if date_val[1] == 0:
value = year
else:
value = "%s. %s" % (self.short_months[date_val[1]], year)
else:
value = "%d. %s. %s" % (date_val[0],
self.short_months[date_val[1]], year)
else:
# D. month YYYY
if date_val[0] == 0:
if date_val[1] == 0:
value = "%s." % year
else:
value = "%s %s" % (self.long_months[date_val[1]], year)
else:
value = "%d. %s %s" % (
date_val[0],self.long_months[date_val[1]], year)
if date_val[2] < 0:
return self._bce_str % value
else:
return value
def display(self, date):
"""
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 u""
elif mod == Date.MOD_SPAN:
d_1 = self.display_cal[cal](start)
d_2 = self.display_cal[cal](date.get_stop_date())
scal = self.format_extras(cal, newyear)
return u"%sod %s do %s%s" % (qual_str, d_1, d_2, scal)
elif mod == Date.MOD_RANGE:
d_1 = self.display_cal[cal](start)
d_2 = self.display_cal[cal](date.get_stop_date())
scal = self.format_extras(cal, newyear)
date_string = u"%smed %s in %s%s" % (qual_str, d_1, d_2, scal)
date_string = date_string.replace(u"a ",u"em ") #to correct declination
date_string = date_string.replace(u"lem ",u"lom ")
date_string = date_string.replace(u"rem ",u"rom ")
date_string = date_string.replace(u"tem ",u"tom ")
return date_string
else:
text = self.display_cal[date.get_calendar()](start)
scal = self.format_extras(cal, newyear)
date_string = "%s%s%s%s" % (qual_str, self._mod_str[mod], text, scal)
return date_string
#-------------------------------------------------------------------------
#
# Register classes
#
#-------------------------------------------------------------------------
register_datehandler(("sl", "SL", "sl_SI", "slovenščina", "slovenian", "Slovenian",
"sl_SI.UTF8", "sl_SI.UTF-8", "sl_SI.utf-8", "sl_SI.utf8"),
DateParserSL, DateDisplaySL)

View File

@ -45,6 +45,7 @@ import _Date_pl
import _Date_pt
import _Date_ru
import _Date_sk
import _Date_sl
import _Date_sr
import _Date_sv

337
src/plugins/rel/rel_sl.py Normal file
View File

@ -0,0 +1,337 @@
# -*- coding: utf-8 -*-
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2005 Donald N. Allingham
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2009-2010 Andrew I Baznikin
#
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id:rel_sl.py 9912 2008-01-22 09:17:46Z acraphae $
# Written by Bernard Banko, inspired from rel_ru.py by Alex Roitman.
"""
Slovenian-specific definitions of relationships
"""
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
import gen.lib
import Relationship
#-------------------------------------------------------------------------
_ancestors = [ u"", u"starš", u"stari starš", u"prastari starš" ]
_fathers = [ u"", u"oče", u"ded", u"praded", u"prapraded" ]
_mothers = [ u"", u"mati", u"babica", u"prababica", u"praprababica" ]
_descendants = [
u"", u"otrok", u"vnuk(inja)", u"pravnuk(inja)", u"prapravnuk(inja)" ]
_sons = [ u"", u"sin", u"vnuk", u"pravnuk", u"prapravnuk" ]
_daughters = [ u"", u"hči", u"vnukinja", u"pravnukinja", u"prapravnukinja" ]
_maleCousins = [ u"", u"brat", u"bratranec", u"mali bratranec" ]
_femaleCousins = [ u"", u"sestra", u"sestrična", u"mala sestrična" ]
_someCousins = [ u"", u"brat ali sestra", u"bratranec ali sestrična",
u"mali bratranec ali mala sestrična" ]
_aunts = [ u"", u"teta", u"stara teta", u"prateta", u"praprateta" ]
_uncles = [ u"", u"stric", u"stari stric", u"prastric", u"praprastric" ]
_nieces = [ u"", u"nečakinja", u"pranečakinja", u"prapranečakinja" ]
_nephews = [ u"", u"nečak", u"pranečak", u"prapranečak" ]
#plural
_children = [ u"", u"otroci", u"vnuki", u"pravnuki", u"prapravnuki" ]
_parents = [ u"", u"starši", u"stari starši", u"prastarši", u"praprastarši" ]
_siblings = [ u"", u"sorojenci", u"strici", u"stari strici", u"prastrici",
u"praprastrici" ]
_neph_niec = [ u"", u"nečaki", u"pranečaki", u"prapranečaki" ]
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
class RelationshipCalculator(Relationship.RelationshipCalculator):
"""
RelationshipCalculator Class
"""
def __init__(self):
Relationship.RelationshipCalculator.__init__(self)
def getAncestor(self, level):
if level > len(_ancestors)-1:
return u"%s-krat-pra-prednik" % (level-2)
else:
return _ancestors[level]
def getFather(self, level):
if level > len(_fathers)-1:
return u"%s-krat-pra-ded" % (level-2)
else:
return _fathers[level]
def getMother(self, level):
if level > len(_mothers)-1:
return u"%s-krat-pra-babica" % (level-2)
else:
return _mothers[level]
def getSon(self, level):
if level > len(_sons)-1:
return u"%s-krat-pra-vnuk" % (level-2)
else:
return _sons[level]
def getDaughter(self, level):
if level > len(_daughters)-1:
return u"%s-krat-pra-vnukinja" % (level-2)
else:
return _daughters[level]
def getDescendant(self, level):
if level > len(_descendants)-1:
return u"%s-krat-pra-vnuk(inja)" % (level-2)
else:
return _descendants[level]
def getMaleCousin(self, level):
if level > len(_maleCousins)-1:
return u"bratranec v %s. kolenu" % (level*2)
else:
return _maleCousins[level]
def getFemaleCousin(self, level):
if level > len(_femaleCousins)-1:
return u"sestrična v %s. kolenu" % (level*2)
else:
return _femaleCousins[level]
def getSomeCousin(self, level):
if level > len(_someCousins)-1:
return u"bratranec ali sestrična v %s. kolenu" % (level*2)
else:
return _someCousins[level]
def getSuffix(self, distance, level):
# distance-level = 2Gb <=> Gb=1
if distance-level == 2 or distance < 6:
return u""
else:
return u" v %s. kolenu" % (distance)
def getAunt(self, distance, level):
if distance == 5 and level == 1:
return u"mala teta"
elif level > len(_aunts)-1:
return u"%s-krat-pra-teta%s" % (level-2, self.getSuffix(distance, level))
else:
return u"%s%s" % (_aunts[level], self.getSuffix(distance, level))
def getUncle(self, distance, level):
if distance == 5 and level == 1:
return u"mali stric"
elif level > len(_uncles)-1:
return u"%s-krat-pra-stric%s" % (level-2, self.getSuffix(distance, level))
else:
return u"%s%s" % (_uncles[level], self.getSuffix(distance, level))
def getNiece(self, distance, level):
if distance == 5 and level == 1:
return u"mala nečakinja"
elif level > len(_nieces)-1:
return u"%s-krat-pra-nečakinja%s" % (level-1, self.getSuffix(distance, level))
else:
return u"%s%s" % (_nieces[level], self.getSuffix(distance, level))
def getNephew(self, distance, level):
if distance == 5 and level == 1:
return u"mali nečak"
elif level > len(_nephews)-1:
return u"%s-krat-pra-nečak%s" % (level-1, self.getSuffix(distance, level))
else:
return u"%s%s" % (_nephews[level], self.getSuffix(distance, level))
def get_single_relationship_string(
self, Ga, Gb, gender_a, gender_b, reltocommon_a, reltocommon_b,
only_birth=True, in_law_a=False, in_law_b=False):
"""
Provide a string that describes the relationsip between a person, and
another person. E.g. "grandparent" or "child".
To be used as: 'person b is the grandparent of a', this will
be in translation string :
'person b is the %(relation)s of a'
Note that languages with gender should add 'the' inside the
translation, so eg in french:
'person b est %(relation)s de a'
where relation will be here: le grandparent
Ga and Gb can be used to mathematically calculate the relationship.
See the Wikipedia entry for more information:
http://en.wikipedia.org/wiki/Cousin#Mathematical_definitions
"""
if Gb == 0:
if Ga == 0: rel_str = "ista oseba"
elif gender_b == gen.lib.Person.MALE:
rel_str = (self.getFather(Ga))
elif gender_b == gen.lib.Person.FEMALE:
rel_str = (self.getMother(Ga))
else:
rel_str = (self.getAncestor(Ga))
elif Ga == 0:
if gender_b == gen.lib.Person.MALE:
rel_str = (self.getSon(Gb))
elif gender_b == gen.lib.Person.FEMALE:
rel_str = (self.getDaughter(Gb))
else:
rel_str = (self.getDescendant(Gb))
elif Ga == Gb:
if gender_b == gen.lib.Person.MALE:
rel_str = (self.getMaleCousin(Gb))
elif gender_b == gen.lib.Person.FEMALE:
rel_str = (self.getFemaleCousin(Gb))
else:
rel_str = (self.getSomeCousin(Gb))
elif Ga > Gb:
if gender_b == gen.lib.Person.FEMALE:
rel_str = (self.getAunt(Ga+Gb, Ga-Gb))
else:
rel_str = (self.getUncle(Ga+Gb, Ga-Gb)) # we'll use male for unknown sex
else: #Ga < Gb
if gender_b == gen.lib.Person.FEMALE:
rel_str = (self.getNiece(Ga+Gb, Gb-Ga))
else:
rel_str = (self.getNephew(Ga+Gb, Gb-Ga)) # we'll use male for unknown sex
return rel_str
def get_sibling_relationship_string(self, sib_type, gender_a, gender_b,
in_law_a=False, in_law_b=False):
""" Determine the string giving the relation between two siblings of
type sib_type.
Eg: b is the brother of a
Here 'brother' is the string we need to determine
This method gives more details about siblings than
get_single_relationship_string can do.
DON'T TRANSLATE THIS PROCEDURE IF LOGIC IS EQUAL IN YOUR LANGUAGE,
AND SAME METHODS EXIST (get_uncle, get_aunt, get_sibling
"""
gender = gender_b #we don't need gender_a
inlaw = in_law_a or in_law_b
if sib_type == self.HALF_SIB_MOTHER or sib_type == self.HALF_SIB_FATHER:
prefix = u"pol"
else:
prefix = u""
if sib_type < self.STEP_SIB:
# ie. NORM_SIB or one of HALF_SIBs
if not inlaw:
if gender == gen.lib.Person.MALE:
rel_str = u"%sbrat" % (prefix)
elif gender == gen.lib.Person.FEMALE:
rel_str = u"%ssestra" % (prefix)
else:
rel_str = u"%sbrat ali %ssestra" % (prefix, prefix)
else:
if gender == gen.lib.Person.MALE:
rel_str = u"%ssvak" % (prefix)
elif gender == gen.lib.Person.FEMALE:
rel_str = u"%ssvakinja" % (prefix)
else:
rel_str = u"%ssvak ali %ssvakinja" % (prefix, prefix)
else:
rel_str = u""
return rel_str
def get_plural_relationship_string(
self, Ga, Gb, reltocommon_a='', reltocommon_b='', only_birth=True,
in_law_a=False, in_law_b=False):
distance = Ga+Gb
rel_str = u"sorodniki v %s. kolenu" % (distance)
if Ga == 0:
# These are descendants
if Gb < len(_children):
rel_str = _children[Gb]
else:
rel_str = u"%s-krat-pra-vnuki" % (Gb-2)
elif Gb == 0:
# These are parents/grand parents
if Ga < len(_parents):
rel_str = _parents[Ga]
else:
rel_str = u"%s-krat-pra-starši" % (Ga-2)
elif Gb == 1:
# These are siblings/aunts/uncles
if Ga < len(_siblings):
rel_str = _siblings[Ga]
else:
rel_str = u"%s-krat-pra-strici" % (Ga-2)
elif Ga == 1:
# These are nieces/nephews
if Gb < len(_neph_niec):
rel_str = _neph_niec[Gb]
else:
rel_str = u"%s-krat-pra-nečaki" % (Gb-1)
elif Ga == Gb:
# These are cousins in the same generation
if Ga == 2:
rel_str = u"bratranci"
elif Ga == 3:
rel_str = u"mali bratranci"
else:
rel_str = u"bratranci v %s. kolenu" % (distance)
elif Ga > Gb:
# These are cousins in different generations with the second person
# being in a higher generation from the common ancestor than the
# first person.
level = Ga - Gb
if distance == 5:
rel_str = u"mali strici"
elif level < len(_siblings)-1:
# len-1 and level+1 to skip the siblings in uncles' levels
rel_str = u"%s v %s. kolenu" % (_siblings[level+1], distance)
else:
rel_str = u"%s-krat-pra-strici v %s. kolenu" % (level-2, distance)
else: #Gb > Ga:
# These are cousins in different generations with the second person
# being in a lower generation from the common ancestor than the
# first person.
level = Gb - Ga
if distance == 5:
rel_str = u"mali nečaki"
elif level < len(_neph_niec):
rel_str = u"%s v %s. kolenu" % (_neph_niec[level], distance)
else:
rel_str = u"%s-krat-pra-nečaki v %s. kolenu" % (level-1, distance)
if in_law_b == True:
rel_str = "zakonci, ki jih imajo %s" % rel_str
return rel_str
if __name__ == "__main__":
"""TRANSLATORS, copy this if statement at the bottom of your
rel_xx.py module, and test your work with:
python src/plugins/rel/rel_xx.py
"""
from Relationship import test
RC = RelationshipCalculator()
test(RC, True)
#
#from PluginMgr import register_relcalc
# register_relcalc(RelationshipCalculatorClass,["sl","sl_SI","sl-SI","slovenian","Slovenian","slovenščina"])

View File

@ -253,6 +253,19 @@ plg.relcalcclass = 'RelationshipCalculator'
plg.lang_list = ["sk", "SK", "sk_SK", "slovensky", "slovak", "Slovak",
"sk_SK.UTF8", "sk_SK.UTF-8", "sk_SK.utf-8", "sk_SK.utf8"]
# sl
plg = newplugin()
plg.id = 'relcalc_sl'
plg.name = _("Slovenian Relationship Calculator")
plg.description = _("Calculates relationships between people")
plg.version = '1.0'
plg.gramps_target_version = '3.3'
plg.status = STABLE
plg.fname = 'rel_sl.py'
plg.ptype = RELCALC
plg.relcalcclass = 'RelationshipCalculator'
plg.lang_list = ["sl", "SL", "sl_SI", "slovenščina", "slovenian", "Slovenian",
"sl_SI.UTF8", "sl_SI.UTF-8", "sl_SI.utf-8", "sl_SI.utf8"]
# sv
plg = newplugin()
plg.id = 'relcalc_sv'