From 340cc8fb98e306f99d2999f0feb48b4c37489bb2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Beno=C3=AEt=20Fontaine?= Date: Tue, 19 Dec 2017 10:23:30 +0100 Subject: [PATCH] Add events: Stillborn, Bar Mitzvah, Bat Mitzvah, Naturalization, Residence, Affiliation, Religious Affiliation, Title of Nobility, Cremation, Caste Name, Clan Name, National Identification, National Origin, Race, Tribe Name --- fsearch_translation.py | 74 +++++++++++++++++++++++++++++++++++++++++- getmyancestors.py | 38 ++++++++++++++++++---- mergemyancestors.py | 17 ++++++---- 3 files changed, 116 insertions(+), 13 deletions(-) diff --git a/fsearch_translation.py b/fsearch_translation.py index cca1fa6..d899bed 100644 --- a/fsearch_translation.py +++ b/fsearch_translation.py @@ -22,5 +22,77 @@ translations = { "pt": "Colaboradores", "ru": "Авторы", "zh": "贡献者" - } + }, + "Stillborn": { + "de": "Tot geboren", + "eo": "[Šţîļļƀöŕñ----------- П國カ내]", + "es": "Nacido muerto o mortinato", + "fr": "Mort-né(e)", + "it": "Nato morto", + "ja": "死産", + "ko": "사산아", + "pt": "Natimorto", + "ru": "Мертворожденный", + "zh": "死胎" + }, + "Affiliation": { + "de": "Zugehörigkeit", + "eo": "[Ńƒîļîåţîöñ---- П國カ내]", + "es": "Afiliación", + "fr": "Affiliation", + "it": "Affiliazione", + "ja": "所属", + "ko": "소속", + "pt": "Afiliação", + "ru": "Принадлежность", + "zh": "所屬團體" + }, + "Clan Name": { + "de": "Bezeichnung des Clans", + "eo": "[Çļåñ Ñåɱé----------- П國カ내]", + "es": "Nombre del clan", + "fr": "Nom de clan", + "it": "Nome clan", + "ja": "氏族名", + "ko": "씨족 이름", + "pt": "Nome do Clã", + "ru": "Название клана", + "zh": "氏族名字" + }, + "National Identification": { + "de": "Ausweisnummer", + "eo": "[Ñåţîöñåļ Îðéñţîƒîçåţîöñ----------- П國カ내]", + "es": "Identificación nacional", + "fr": "Numéro national d’identification", + "it": "Documento di identità", + "ja": "国民登録番号", + "ko": "주민등록번호", + "pt": "Carteira de Identidade Nacional", + "ru": "Удостоверение личности", + "zh": "國民身分證" + }, + "Race": { + "de": "Ethnische Zugehörigkeit", + "eo": "[Ŕåçé- П國カ내]", + "es": "Raza", + "fr": "Race", + "it": "Razza", + "ja": "人種", + "ko": "인종", + "pt": "Raça", + "ru": "Раса", + "zh": "種族" + }, + "Tribe Name": { + "de": "Bezeichnung des Stammes", + "eo": "[Ţŕîƀé Ñåɱé------------- П國カ내]", + "es": "Nombre de la tribu", + "fr": "Nom de tribu", + "it": "Nome tribù", + "ja": "部族名", + "ko": "부족명", + "pt": "Nome da Tribo", + "ru": "Название племени", + "zh": "部落名字" + }, } diff --git a/getmyancestors.py b/getmyancestors.py index bd8ac13..062fb1b 100755 --- a/getmyancestors.py +++ b/getmyancestors.py @@ -47,7 +47,25 @@ FACT_TAGS = { 'http://gedcomx.org/Marriage': 'MARR', 'http://gedcomx.org/Divorce': 'DIV', 'http://gedcomx.org/Annulment': 'ANUL', - 'http://gedcomx.org/CommonLawMarriage': '_COML' + 'http://gedcomx.org/CommonLawMarriage': '_COML', + 'http://gedcomx.org/BarMitzvah': 'BARM', + 'http://gedcomx.org/BatMitzvah': 'BASM', + 'http://gedcomx.org/Naturalization': 'NATU', + 'http://gedcomx.org/Residence': 'RESI', + 'http://gedcomx.org/Religion': 'RELI', + 'http://familysearch.org/v1/TitleOfNobility': 'TITL', + 'http://gedcomx.org/Cremation': 'CREM', + 'http://gedcomx.org/Caste': 'CAST', + 'http://gedcomx.org/Nationality': 'NATI', +} + +FACT_EVEN = { + 'http://gedcomx.org/Stillbirth': 'Stillborn', + 'http://familysearch.org/v1/Affiliation': 'Affiliation', + 'http://gedcomx.org/Clan': 'Clan Name', + 'http://gedcomx.org/NationalId': 'National Identification', + 'http://gedcomx.org/Ethnicity': 'Race', + 'http://familysearch.org/v1/TribeName': 'Tribe Name' } @@ -321,24 +339,32 @@ class Fact: self.value = data['value'] if 'type' in data: self.type = data['type'] + if self.type in FACT_EVEN: + self.type = tree.fs._(FACT_EVEN[self.type]) + elif self.type[:6] == u'data:,': + self.type = self.type[6:] + elif self.type not in FACT_TAGS: + self.type = None if 'date' in data: self.date = data['date']['original'] if 'place' in data: self.place = data['place']['original'] if 'changeMessage' in data['attribution']: self.note = Note(data['attribution']['changeMessage'], tree) - if self.type == 'http://gedcomx.org/Death' and not any([self.date, self.place]): + if self.type == 'http://gedcomx.org/Death' and not (self.date or self.place): self.value = 'Y' def print(self, file=sys.stdout, key=None): if self.type in FACT_TAGS: file.write('1 ' + FACT_TAGS[self.type]) - elif self.type[:6] == u'data:,': - file.write('1 EVEN\n2 TYPE ' + self.type[6:] + '\n2 NOTE Description:') + if self.value: + file.write(' ' + self.value) + elif self.type: + file.write('1 EVEN\n2 TYPE ' + self.type) + if self.value: + file.write('\n2 NOTE Description: ' + self.value) else: return - if self.value: - file.write(' ' + self.value) file.write('\n') if self.date: file.write('2 DATE ' + self.date + '\n') diff --git a/mergemyancestors.py b/mergemyancestors.py index 2f12e65..dff90c4 100755 --- a/mergemyancestors.py +++ b/mergemyancestors.py @@ -225,20 +225,25 @@ class Gedcom: def __get_fact(self): fact = Fact() - if self.tag == 'EVEN': - self.__get_line() - fact.type = 'data:,' + self.data - self.__get_line() - fact.value = self.data[12:] - else: + # if self.tag == 'EVEN': + # self.__get_line() + # fact.type = self.data + # self.__get_line() + # fact.value = self.data[12:] + if self.tag != 'EVEN': fact.type = FACT_TYPES[self.tag] fact.value = self.data while self.__get_line() and self.level > 1: + if self.tag == 'TYPE': + fact.type = self.data if self.tag == 'DATE': fact.date = self.data elif self.tag == 'PLAC': fact.place = self.data elif self.tag == 'NOTE': + if self.data[:12] == 'Description:': + fact.value = self.data[13:] + continue num = int(self.data[2:len(self.data) - 1]) if num not in self.note: self.note[num] = Note(tree=self.tree, num=num) -- 2.52.0