Issue 4425: Abbreviation algorithm does not work for all languages.

svn: r16520
This commit is contained in:
Peter Landgren 2011-01-31 20:08:09 +00:00
parent 1aa71cceaa
commit 243d02a6f5

View File

@ -189,9 +189,52 @@ class EventType(GrampsType):
] ]
_ABBREVIATIONS = { _ABBREVIATIONS = {
BIRTH: _("birth abbreviation|b"), BIRTH: _("birth abbreviation|b."),
DEATH: _("death abbreviation|d"), DEATH: _("death abbreviation|d."),
MARRIAGE: _("marriage abbreviation|m"), MARRIAGE: _("marriage abbreviation|m."),
UNKNOWN: _("Unknown abbreviation|unkn."),
CUSTOM: _("Custom abbreviation|cust."),
ADOPT: _("Adopted abbreviation|adop."),
ADULT_CHRISTEN : _("Adult Christening abbreviation|a.chr."),
BAPTISM: _("Baptism abbreviation|bap."),
BAR_MITZVAH : _("Bar Mitzvah abbreviation|bar."),
BAS_MITZVAH : _("Bas Mitzvah abbreviation|bas."),
BLESS: _("Blessing abbreviation|bles."),
BURIAL: _("Burial abbreviation|bur."),
CAUSE_DEATH : _("Cause Of Death abbreviation|c.o.d."),
CENSUS: _("Census abbreviation|cens."),
CHRISTEN: _("Christening abbreviation|chr."),
CONFIRMATION: _("Confirmation abbreviation|conf."),
CREMATION: _("Cremation abbreviation|crem."),
DEGREE: _("Degree abbreviation|degr."),
EDUCATION: _("Education abbreviation|edu."),
ELECTED: _("Elected abbreviation|elec."),
EMIGRATION: _("Emigration abbreviation|emi."),
FIRST_COMMUN: _("First Communion abbreviation|f.comm."),
IMMIGRATION: _("Immigration abbreviation|immi."),
GRADUATION: _("Graduation abbreviation|gradu."),
MED_INFO: _("Medical Information abbreviation|medinf."),
MILITARY_SERV: _("Military Service abbreviation|milser."),
NATURALIZATION: _("Naturalization abbreviation|natu."),
NOB_TITLE: _("Nobility Title abbreviation|nob."),
NUM_MARRIAGES: _("Number of Marriages abbreviation|n.o.mar."),
OCCUPATION: _("Occupation abbreviation|occu."),
ORDINATION: _("Ordination abbreviation|ordi."),
PROBATE: _("Probate abbreviation|prob."),
PROPERTY: _("Property abbreviation|prop."),
RELIGION: _("Religion abbreviation|rel."),
RESIDENCE: _("Residence abbreviation|res."),
RETIREMENT: _("Retirement abbreviation|ret."),
WILL: _("Will abbreviation|will."),
MARR_SETTL: _("Marriage Settlement abbreviation|m.set."),
MARR_LIC: _("Marriage License abbreviation|m.lic."),
MARR_CONTR: _("Marriage Contract abbreviation|m.con."),
MARR_BANNS: _("Marriage Banns abbreviation|m.ban."),
MARR_ALT: _("Alternate Marriage abbreviation|alt.mar."),
ENGAGEMENT: _("Engagement abbreviation|enga."),
DIVORCE: _("Divorce abbreviation|div."),
DIV_FILING: _("Divorce Filing abbreviation|div.f."),
ANNULMENT: _("Annulment abbreviation|annu.")
} }
def __init__(self, value=None): def __init__(self, value=None):
@ -243,10 +286,11 @@ class EventType(GrampsType):
""" """
Returns the abbreviation for this event. Uses the explicitly Returns the abbreviation for this event. Uses the explicitly
given abbreviations, or first letter of each word, or the first given abbreviations, or first letter of each word, or the first
three letters. Appends a period after the abbreviation. three letters. Appends a period after the abbreviation,
but not if string is in _ABBREVIATIONS.
""" """
if self.value in self._ABBREVIATIONS: if self.value in self._ABBREVIATIONS:
return self._ABBREVIATIONS[self.value] + "." return self._ABBREVIATIONS[self.value]
else: else:
abbrev = str(self) abbrev = str(self)
if " " in abbrev: if " " in abbrev: