@treeviz/gedcom-parser 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +954 -0
- package/dist/classes/common.d.ts +87 -0
- package/dist/classes/common.d.ts.map +1 -0
- package/dist/classes/common.js +481 -0
- package/dist/classes/date.d.ts +26 -0
- package/dist/classes/date.d.ts.map +1 -0
- package/dist/classes/date.js +176 -0
- package/dist/classes/fam.d.ts +19 -0
- package/dist/classes/fam.d.ts.map +1 -0
- package/dist/classes/fam.js +38 -0
- package/dist/classes/fams.d.ts +16 -0
- package/dist/classes/fams.d.ts.map +1 -0
- package/dist/classes/fams.js +41 -0
- package/dist/classes/gedcom.d.ts +89 -0
- package/dist/classes/gedcom.d.ts.map +1 -0
- package/dist/classes/gedcom.js +421 -0
- package/dist/classes/index.d.ts +19 -0
- package/dist/classes/index.d.ts.map +1 -0
- package/dist/classes/index.js +19 -0
- package/dist/classes/indi.d.ts +298 -0
- package/dist/classes/indi.d.ts.map +1 -0
- package/dist/classes/indi.js +2049 -0
- package/dist/classes/indis.d.ts +54 -0
- package/dist/classes/indis.d.ts.map +1 -0
- package/dist/classes/indis.js +439 -0
- package/dist/classes/list.d.ts +55 -0
- package/dist/classes/list.d.ts.map +1 -0
- package/dist/classes/list.js +440 -0
- package/dist/classes/name.d.ts +20 -0
- package/dist/classes/name.d.ts.map +1 -0
- package/dist/classes/name.js +48 -0
- package/dist/classes/note.d.ts +12 -0
- package/dist/classes/note.d.ts.map +1 -0
- package/dist/classes/note.js +46 -0
- package/dist/classes/obje.d.ts +12 -0
- package/dist/classes/obje.d.ts.map +1 -0
- package/dist/classes/obje.js +81 -0
- package/dist/classes/objes.d.ts +8 -0
- package/dist/classes/objes.d.ts.map +1 -0
- package/dist/classes/objes.js +13 -0
- package/dist/classes/repo.d.ts +11 -0
- package/dist/classes/repo.d.ts.map +1 -0
- package/dist/classes/repo.js +6 -0
- package/dist/classes/repos.d.ts +8 -0
- package/dist/classes/repos.d.ts.map +1 -0
- package/dist/classes/repos.js +13 -0
- package/dist/classes/sour.d.ts +11 -0
- package/dist/classes/sour.d.ts.map +1 -0
- package/dist/classes/sour.js +6 -0
- package/dist/classes/sours.d.ts +8 -0
- package/dist/classes/sours.d.ts.map +1 -0
- package/dist/classes/sours.js +13 -0
- package/dist/classes/subm.d.ts +10 -0
- package/dist/classes/subm.d.ts.map +1 -0
- package/dist/classes/subm.js +6 -0
- package/dist/classes/subms.d.ts +8 -0
- package/dist/classes/subms.d.ts.map +1 -0
- package/dist/classes/subms.js +13 -0
- package/dist/constants/constants.d.ts +14 -0
- package/dist/constants/constants.d.ts.map +1 -0
- package/dist/constants/constants.js +13 -0
- package/dist/constants/filters.d.ts +17 -0
- package/dist/constants/filters.d.ts.map +1 -0
- package/dist/constants/filters.js +44 -0
- package/dist/constants/index.d.ts +4 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +4 -0
- package/dist/constants/orders.d.ts +17 -0
- package/dist/constants/orders.d.ts.map +1 -0
- package/dist/constants/orders.js +240 -0
- package/dist/factories/cache-factory.d.ts +30 -0
- package/dist/factories/cache-factory.d.ts.map +1 -0
- package/dist/factories/cache-factory.js +43 -0
- package/dist/factories/date-locale-factory.d.ts +30 -0
- package/dist/factories/date-locale-factory.d.ts.map +1 -0
- package/dist/factories/date-locale-factory.js +34 -0
- package/dist/factories/i18n-factory.d.ts +40 -0
- package/dist/factories/i18n-factory.d.ts.map +1 -0
- package/dist/factories/i18n-factory.js +44 -0
- package/dist/factories/index.d.ts +5 -0
- package/dist/factories/index.d.ts.map +1 -0
- package/dist/factories/index.js +5 -0
- package/dist/factories/kinship-factory.d.ts +38 -0
- package/dist/factories/kinship-factory.d.ts.map +1 -0
- package/dist/factories/kinship-factory.js +35 -0
- package/dist/factories/place-parser-provider.d.ts +32 -0
- package/dist/factories/place-parser-provider.d.ts.map +1 -0
- package/dist/factories/place-parser-provider.js +35 -0
- package/dist/factories/place-translator-provider.d.ts +32 -0
- package/dist/factories/place-translator-provider.d.ts.map +1 -0
- package/dist/factories/place-translator-provider.js +35 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/interfaces/common.d.ts +43 -0
- package/dist/interfaces/common.d.ts.map +1 -0
- package/dist/interfaces/common.js +1 -0
- package/dist/interfaces/fam.d.ts +11 -0
- package/dist/interfaces/fam.d.ts.map +1 -0
- package/dist/interfaces/fam.js +1 -0
- package/dist/interfaces/fams.d.ts +9 -0
- package/dist/interfaces/fams.d.ts.map +1 -0
- package/dist/interfaces/fams.js +1 -0
- package/dist/interfaces/gedcom.d.ts +30 -0
- package/dist/interfaces/gedcom.d.ts.map +1 -0
- package/dist/interfaces/gedcom.js +1 -0
- package/dist/interfaces/index.d.ts +12 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +1 -0
- package/dist/interfaces/indi.d.ts +109 -0
- package/dist/interfaces/indi.d.ts.map +1 -0
- package/dist/interfaces/indi.js +1 -0
- package/dist/interfaces/indis.d.ts +31 -0
- package/dist/interfaces/indis.d.ts.map +1 -0
- package/dist/interfaces/indis.js +1 -0
- package/dist/interfaces/list.d.ts +52 -0
- package/dist/interfaces/list.d.ts.map +1 -0
- package/dist/interfaces/list.js +1 -0
- package/dist/interfaces/obje.d.ts +7 -0
- package/dist/interfaces/obje.d.ts.map +1 -0
- package/dist/interfaces/obje.js +1 -0
- package/dist/interfaces/repo.d.ts +7 -0
- package/dist/interfaces/repo.d.ts.map +1 -0
- package/dist/interfaces/repo.js +1 -0
- package/dist/interfaces/sour.d.ts +7 -0
- package/dist/interfaces/sour.d.ts.map +1 -0
- package/dist/interfaces/sour.js +1 -0
- package/dist/interfaces/subm.d.ts +6 -0
- package/dist/interfaces/subm.d.ts.map +1 -0
- package/dist/interfaces/subm.js +1 -0
- package/dist/kinship-translator/index.d.ts +11 -0
- package/dist/kinship-translator/index.d.ts.map +1 -0
- package/dist/kinship-translator/index.js +10 -0
- package/dist/kinship-translator/kinship-translator.basic.d.ts +30 -0
- package/dist/kinship-translator/kinship-translator.basic.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.basic.js +74 -0
- package/dist/kinship-translator/kinship-translator.d.ts +26 -0
- package/dist/kinship-translator/kinship-translator.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.de.d.ts +18 -0
- package/dist/kinship-translator/kinship-translator.de.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.de.js +180 -0
- package/dist/kinship-translator/kinship-translator.en.d.ts +18 -0
- package/dist/kinship-translator/kinship-translator.en.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.en.js +182 -0
- package/dist/kinship-translator/kinship-translator.es.d.ts +18 -0
- package/dist/kinship-translator/kinship-translator.es.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.es.js +181 -0
- package/dist/kinship-translator/kinship-translator.fr.d.ts +18 -0
- package/dist/kinship-translator/kinship-translator.fr.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.fr.js +181 -0
- package/dist/kinship-translator/kinship-translator.hu.d.ts +19 -0
- package/dist/kinship-translator/kinship-translator.hu.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.hu.js +226 -0
- package/dist/kinship-translator/kinship-translator.interface.d.ts +19 -0
- package/dist/kinship-translator/kinship-translator.interface.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.interface.js +1 -0
- package/dist/kinship-translator/kinship-translator.js +103 -0
- package/dist/kinship-translator/patterns.de.d.ts +2 -0
- package/dist/kinship-translator/patterns.de.d.ts.map +1 -0
- package/dist/kinship-translator/patterns.de.js +14 -0
- package/dist/kinship-translator/patterns.en.d.ts +2 -0
- package/dist/kinship-translator/patterns.en.d.ts.map +1 -0
- package/dist/kinship-translator/patterns.en.js +14 -0
- package/dist/kinship-translator/patterns.es.d.ts +2 -0
- package/dist/kinship-translator/patterns.es.d.ts.map +1 -0
- package/dist/kinship-translator/patterns.es.js +14 -0
- package/dist/kinship-translator/patterns.fr.d.ts +2 -0
- package/dist/kinship-translator/patterns.fr.d.ts.map +1 -0
- package/dist/kinship-translator/patterns.fr.js +14 -0
- package/dist/kinship-translator/patterns.hu.d.ts +6 -0
- package/dist/kinship-translator/patterns.hu.d.ts.map +1 -0
- package/dist/kinship-translator/patterns.hu.js +97 -0
- package/dist/kinship-translator/translators.d.ts +6 -0
- package/dist/kinship-translator/translators.d.ts.map +1 -0
- package/dist/kinship-translator/translators.js +5 -0
- package/dist/kinship-translator/types.d.ts +9 -0
- package/dist/kinship-translator/types.d.ts.map +1 -0
- package/dist/kinship-translator/types.js +1 -0
- package/dist/structures/address.d.ts +14 -0
- package/dist/structures/address.d.ts.map +1 -0
- package/dist/structures/address.js +1 -0
- package/dist/structures/association.d.ts +13 -0
- package/dist/structures/association.d.ts.map +1 -0
- package/dist/structures/association.js +1 -0
- package/dist/structures/change-date.d.ts +8 -0
- package/dist/structures/change-date.d.ts.map +1 -0
- package/dist/structures/change-date.js +1 -0
- package/dist/structures/creation-date.d.ts +7 -0
- package/dist/structures/creation-date.d.ts.map +1 -0
- package/dist/structures/creation-date.js +1 -0
- package/dist/structures/date.d.ts +9 -0
- package/dist/structures/date.d.ts.map +1 -0
- package/dist/structures/date.js +1 -0
- package/dist/structures/event-detail-structure.d.ts +25 -0
- package/dist/structures/event-detail-structure.d.ts.map +1 -0
- package/dist/structures/event-detail-structure.js +1 -0
- package/dist/structures/family.d.ts +34 -0
- package/dist/structures/family.d.ts.map +1 -0
- package/dist/structures/family.js +1 -0
- package/dist/structures/gedcom.d.ts +60 -0
- package/dist/structures/gedcom.d.ts.map +1 -0
- package/dist/structures/gedcom.js +1 -0
- package/dist/structures/index.d.ts +25 -0
- package/dist/structures/index.d.ts.map +1 -0
- package/dist/structures/index.js +1 -0
- package/dist/structures/individual-event-detail-structure.d.ts +9 -0
- package/dist/structures/individual-event-detail-structure.d.ts.map +1 -0
- package/dist/structures/individual-event-detail-structure.js +1 -0
- package/dist/structures/individual-event-structure.d.ts +83 -0
- package/dist/structures/individual-event-structure.d.ts.map +1 -0
- package/dist/structures/individual-event-structure.js +1 -0
- package/dist/structures/individual.d.ts +40 -0
- package/dist/structures/individual.d.ts.map +1 -0
- package/dist/structures/individual.js +1 -0
- package/dist/structures/lds-ordinance-detail.d.ts +17 -0
- package/dist/structures/lds-ordinance-detail.d.ts.map +1 -0
- package/dist/structures/lds-ordinance-detail.js +1 -0
- package/dist/structures/lds-spouse-sealing.d.ts +7 -0
- package/dist/structures/lds-spouse-sealing.d.ts.map +1 -0
- package/dist/structures/lds-spouse-sealing.js +1 -0
- package/dist/structures/marriage-date.d.ts +11 -0
- package/dist/structures/marriage-date.d.ts.map +1 -0
- package/dist/structures/marriage-date.js +1 -0
- package/dist/structures/multimedia-link.d.ts +16 -0
- package/dist/structures/multimedia-link.d.ts.map +1 -0
- package/dist/structures/multimedia-link.js +1 -0
- package/dist/structures/non-event.d.ts +12 -0
- package/dist/structures/non-event.d.ts.map +1 -0
- package/dist/structures/non-event.js +1 -0
- package/dist/structures/note.d.ts +16 -0
- package/dist/structures/note.d.ts.map +1 -0
- package/dist/structures/note.js +1 -0
- package/dist/structures/personal-name-pieces.d.ts +11 -0
- package/dist/structures/personal-name-pieces.d.ts.map +1 -0
- package/dist/structures/personal-name-pieces.js +1 -0
- package/dist/structures/personal-name.d.ts +16 -0
- package/dist/structures/personal-name.d.ts.map +1 -0
- package/dist/structures/personal-name.js +1 -0
- package/dist/structures/place.d.ts +20 -0
- package/dist/structures/place.d.ts.map +1 -0
- package/dist/structures/place.js +1 -0
- package/dist/structures/repository.d.ts +6 -0
- package/dist/structures/repository.d.ts.map +1 -0
- package/dist/structures/repository.js +1 -0
- package/dist/structures/source-citation.d.ts +27 -0
- package/dist/structures/source-citation.d.ts.map +1 -0
- package/dist/structures/source-citation.js +1 -0
- package/dist/structures/source-repository-citation.d.ts +13 -0
- package/dist/structures/source-repository-citation.d.ts.map +1 -0
- package/dist/structures/source-repository-citation.js +1 -0
- package/dist/structures/source.d.ts +28 -0
- package/dist/structures/source.d.ts.map +1 -0
- package/dist/structures/source.js +1 -0
- package/dist/types/ancestry-media.d.ts +65 -0
- package/dist/types/ancestry-media.d.ts.map +1 -0
- package/dist/types/ancestry-media.js +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/settings.d.ts +12 -0
- package/dist/types/settings.d.ts.map +1 -0
- package/dist/types/settings.js +1 -0
- package/dist/types/types.d.ts +220 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +26 -0
- package/dist/utils/cache.d.ts +22 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +57 -0
- package/dist/utils/common-creator.d.ts +13 -0
- package/dist/utils/common-creator.d.ts.map +1 -0
- package/dist/utils/common-creator.js +72 -0
- package/dist/utils/date-formatter.d.ts +35 -0
- package/dist/utils/date-formatter.d.ts.map +1 -0
- package/dist/utils/date-formatter.js +207 -0
- package/dist/utils/get-all-prop.d.ts +4 -0
- package/dist/utils/get-all-prop.d.ts.map +1 -0
- package/dist/utils/get-all-prop.js +5 -0
- package/dist/utils/get-family-with.d.ts +5 -0
- package/dist/utils/get-family-with.d.ts.map +1 -0
- package/dist/utils/get-family-with.js +11 -0
- package/dist/utils/get-places.d.ts +21 -0
- package/dist/utils/get-places.d.ts.map +1 -0
- package/dist/utils/get-places.js +77 -0
- package/dist/utils/get-product-details.d.ts +4 -0
- package/dist/utils/get-product-details.d.ts.map +1 -0
- package/dist/utils/get-product-details.js +6 -0
- package/dist/utils/get-raw-size.d.ts +2 -0
- package/dist/utils/get-raw-size.d.ts.map +1 -0
- package/dist/utils/get-raw-size.js +3 -0
- package/dist/utils/index.d.ts +17 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +18 -0
- package/dist/utils/logger.d.ts +3 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +11 -0
- package/dist/utils/name-formatter.d.ts +10 -0
- package/dist/utils/name-formatter.d.ts.map +1 -0
- package/dist/utils/name-formatter.js +45 -0
- package/dist/utils/nested-group.d.ts +4 -0
- package/dist/utils/nested-group.d.ts.map +1 -0
- package/dist/utils/nested-group.js +34 -0
- package/dist/utils/ordinalize.d.ts +3 -0
- package/dist/utils/ordinalize.d.ts.map +1 -0
- package/dist/utils/ordinalize.js +104 -0
- package/dist/utils/parser.d.ts +17 -0
- package/dist/utils/parser.d.ts.map +1 -0
- package/dist/utils/parser.js +322 -0
- package/dist/utils/place-parser.d.ts +16 -0
- package/dist/utils/place-parser.d.ts.map +1 -0
- package/dist/utils/place-parser.js +46 -0
- package/dist/utils/place-translator.d.ts +6 -0
- package/dist/utils/place-translator.d.ts.map +1 -0
- package/dist/utils/place-translator.js +8 -0
- package/dist/utils/place-types.d.ts +27 -0
- package/dist/utils/place-types.d.ts.map +1 -0
- package/dist/utils/place-types.js +14 -0
- package/dist/utils/range.d.ts +19 -0
- package/dist/utils/range.d.ts.map +1 -0
- package/dist/utils/range.js +265 -0
- package/package.json +153 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { nameFormatter } from "../utils/name-formatter";
|
|
2
|
+
import { ordinalize } from "../utils/ordinalize";
|
|
3
|
+
import KinshipTranslatorBasic from "./kinship-translator.basic";
|
|
4
|
+
import { InLawsFr } from "./patterns.fr";
|
|
5
|
+
export default class KinshipTranslatorFr extends KinshipTranslatorBasic {
|
|
6
|
+
directPrefix() {
|
|
7
|
+
const level = Math.abs(this.pathN?.level ?? 0);
|
|
8
|
+
if (level <= 1) {
|
|
9
|
+
return "";
|
|
10
|
+
}
|
|
11
|
+
if (level === 2) {
|
|
12
|
+
return "grand-";
|
|
13
|
+
}
|
|
14
|
+
if (level === 3) {
|
|
15
|
+
return "arrière-grand-";
|
|
16
|
+
}
|
|
17
|
+
return `arrière${level - 2}-grand-`;
|
|
18
|
+
}
|
|
19
|
+
indirect() {
|
|
20
|
+
let degree = Math.abs(this.pathN?.degree ?? 0);
|
|
21
|
+
if (degree > 0) {
|
|
22
|
+
degree = degree - 1;
|
|
23
|
+
}
|
|
24
|
+
if (degree === 1) {
|
|
25
|
+
return `cousin`;
|
|
26
|
+
}
|
|
27
|
+
return `cousin au ${ordinalize(degree)} degré`;
|
|
28
|
+
}
|
|
29
|
+
removal() {
|
|
30
|
+
const level = this.pathN?.level ?? 0;
|
|
31
|
+
let degree = Math.abs(this.pathN?.degree ?? 0);
|
|
32
|
+
if (degree > 0) {
|
|
33
|
+
degree = degree - 1;
|
|
34
|
+
}
|
|
35
|
+
if (!degree) {
|
|
36
|
+
return level < 0 ? this.nibling() : this.auncle();
|
|
37
|
+
}
|
|
38
|
+
return `cousin au ${ordinalize(degree)} degré ${Math.abs(level)}× éloigné`;
|
|
39
|
+
}
|
|
40
|
+
auncle() {
|
|
41
|
+
const prefix = this.directPrefix();
|
|
42
|
+
if (this.personN?.isMale()) {
|
|
43
|
+
return `${prefix}oncle`;
|
|
44
|
+
}
|
|
45
|
+
if (this.personN?.isFemale()) {
|
|
46
|
+
return `${prefix}tante`;
|
|
47
|
+
}
|
|
48
|
+
return `${prefix}oncle/tante`;
|
|
49
|
+
}
|
|
50
|
+
nibling() {
|
|
51
|
+
const prefix = this.directPrefix();
|
|
52
|
+
if (this.personN?.isMale()) {
|
|
53
|
+
return `${prefix}neveu`;
|
|
54
|
+
}
|
|
55
|
+
if (this.personN?.isFemale()) {
|
|
56
|
+
return `${prefix}nièce`;
|
|
57
|
+
}
|
|
58
|
+
return `${prefix}neveu/nièce`;
|
|
59
|
+
}
|
|
60
|
+
parent() {
|
|
61
|
+
const prefix = this.directPrefix();
|
|
62
|
+
if (this.personN?.isMale()) {
|
|
63
|
+
return `${prefix}père`;
|
|
64
|
+
}
|
|
65
|
+
if (this.personN?.isFemale()) {
|
|
66
|
+
return `${prefix}mère`;
|
|
67
|
+
}
|
|
68
|
+
return `${prefix}parent`;
|
|
69
|
+
}
|
|
70
|
+
child() {
|
|
71
|
+
const prefix = this.directPrefix();
|
|
72
|
+
if (this.personN?.isMale()) {
|
|
73
|
+
return `${prefix}fils`;
|
|
74
|
+
}
|
|
75
|
+
if (this.personN?.isFemale()) {
|
|
76
|
+
return `${prefix}fille`;
|
|
77
|
+
}
|
|
78
|
+
return `${prefix}enfant`;
|
|
79
|
+
}
|
|
80
|
+
sibling() {
|
|
81
|
+
const parents1 = this.person1?.getBiologicalParents();
|
|
82
|
+
const parentsN = this.personN?.getBiologicalParents();
|
|
83
|
+
const inter = parents1?.intersection(parentsN);
|
|
84
|
+
let prefix = "";
|
|
85
|
+
if (!inter || inter.length < 2) {
|
|
86
|
+
prefix = "demi-";
|
|
87
|
+
}
|
|
88
|
+
if (this.personN?.isMale()) {
|
|
89
|
+
return `${prefix}frère`;
|
|
90
|
+
}
|
|
91
|
+
if (this.personN?.isFemale()) {
|
|
92
|
+
return `${prefix}sœur`;
|
|
93
|
+
}
|
|
94
|
+
return `${prefix}frère/sœur`;
|
|
95
|
+
}
|
|
96
|
+
spouse() {
|
|
97
|
+
if (this.personN?.isMale()) {
|
|
98
|
+
return "mari";
|
|
99
|
+
}
|
|
100
|
+
if (this.personN?.isFemale()) {
|
|
101
|
+
return "épouse";
|
|
102
|
+
}
|
|
103
|
+
return "conjoint";
|
|
104
|
+
}
|
|
105
|
+
ofSpouse(relation) {
|
|
106
|
+
if (!relation) {
|
|
107
|
+
return "";
|
|
108
|
+
}
|
|
109
|
+
const spouse = this.path?.[1].indi;
|
|
110
|
+
let spouseType = "conjoint";
|
|
111
|
+
if (spouse?.isMale()) {
|
|
112
|
+
spouseType = "mari";
|
|
113
|
+
}
|
|
114
|
+
if (spouse?.isFemale()) {
|
|
115
|
+
spouseType = "épouse";
|
|
116
|
+
}
|
|
117
|
+
return `${relation} du ${spouseType}`;
|
|
118
|
+
}
|
|
119
|
+
spouseOf(relation) {
|
|
120
|
+
if (!relation) {
|
|
121
|
+
return "";
|
|
122
|
+
}
|
|
123
|
+
const spouse = this.path?.[this.path.length - 1].indi;
|
|
124
|
+
let spouseType = "conjoint";
|
|
125
|
+
if (spouse?.isMale()) {
|
|
126
|
+
spouseType = "mari";
|
|
127
|
+
}
|
|
128
|
+
if (spouse?.isFemale()) {
|
|
129
|
+
spouseType = "épouse";
|
|
130
|
+
}
|
|
131
|
+
return `${spouseType} de ${relation}`;
|
|
132
|
+
}
|
|
133
|
+
of(relation) {
|
|
134
|
+
const formattedName = nameFormatter(this.path?.[0]?.indi, {
|
|
135
|
+
nameOrder: "first-last",
|
|
136
|
+
});
|
|
137
|
+
let name = formattedName.inOrder.filter(Boolean).join(" ");
|
|
138
|
+
if (this.displayName === "none") {
|
|
139
|
+
name = "";
|
|
140
|
+
}
|
|
141
|
+
else if (this.displayName === "givenname") {
|
|
142
|
+
name = formattedName.givenname;
|
|
143
|
+
}
|
|
144
|
+
else if (this.displayName === "surname") {
|
|
145
|
+
name = `${formattedName.surname}`;
|
|
146
|
+
}
|
|
147
|
+
if (!name || !relation) {
|
|
148
|
+
return relation ?? "";
|
|
149
|
+
}
|
|
150
|
+
if (relation.includes(" du ") || relation.includes(" de ")) {
|
|
151
|
+
return relation.replace(/ (du|de) /, ` $1 ${name} `);
|
|
152
|
+
}
|
|
153
|
+
return `${relation} de ${name}`;
|
|
154
|
+
}
|
|
155
|
+
inLaw(relation) {
|
|
156
|
+
let inLawRelation = relation;
|
|
157
|
+
Object.keys(InLawsFr).find((pattern) => {
|
|
158
|
+
const regex = new RegExp(`(?<space> )(?<word1>${pattern})$|^(?<word2>${pattern})$`);
|
|
159
|
+
if (relation?.match(regex)) {
|
|
160
|
+
inLawRelation = relation?.replace(regex, (m, ...rest) => {
|
|
161
|
+
const groups = rest[rest.length - 1];
|
|
162
|
+
const word = groups?.word1 || groups?.word2;
|
|
163
|
+
if (!word) {
|
|
164
|
+
return m;
|
|
165
|
+
}
|
|
166
|
+
const toReplace = InLawsFr[word.trim()] || InLawsFr[pattern];
|
|
167
|
+
return toReplace ? `${groups.space || ""}${toReplace}` : m;
|
|
168
|
+
});
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
return false;
|
|
172
|
+
});
|
|
173
|
+
return inLawRelation ?? "";
|
|
174
|
+
}
|
|
175
|
+
relationType(relation) {
|
|
176
|
+
if (!relation || !this.pathN?.relation) {
|
|
177
|
+
return relation ?? "";
|
|
178
|
+
}
|
|
179
|
+
return `${this.pathN.relation} ${relation}`;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import KinshipTranslatorBasic from "./kinship-translator.basic";
|
|
2
|
+
export default class KinshipTranslatorHU extends KinshipTranslatorBasic {
|
|
3
|
+
private directPrefix;
|
|
4
|
+
private caseReplacer;
|
|
5
|
+
indirect(): string;
|
|
6
|
+
removal(): string;
|
|
7
|
+
auncle(): string;
|
|
8
|
+
nibling(): string;
|
|
9
|
+
parent(): string;
|
|
10
|
+
child(): string;
|
|
11
|
+
sibling(): "testvér" | "féltestvér";
|
|
12
|
+
spouse(): "férj" | "feleség" | "házastárs";
|
|
13
|
+
ofSpouse(relation?: string | undefined): string;
|
|
14
|
+
spouseOf(relation?: string | undefined): string;
|
|
15
|
+
of(relation?: string | undefined): string;
|
|
16
|
+
inLaw(relation?: string | undefined): string;
|
|
17
|
+
relationType(relation?: string | undefined): string;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=kinship-translator.hu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kinship-translator.hu.d.ts","sourceRoot":"","sources":["../../src/kinship-translator/kinship-translator.hu.ts"],"names":[],"mappings":"AAGA,OAAO,sBAAsB,MAAM,4BAA4B,CAAC;AAIhE,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,sBAAsB;IACtE,OAAO,CAAC,YAAY;IA6BpB,OAAO,CAAC,YAAY;IA+BpB,QAAQ;IAaR,OAAO;IAgBP,MAAM;IA6BN,OAAO;IAmCP,MAAM;IAcN,KAAK;IAYL,OAAO;IAcP,MAAM;IAYN,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IAmBtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IAuBtC,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IAoChC,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IA6CnC,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;CAO1C"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { nameFormatter } from "../utils/name-formatter";
|
|
2
|
+
import { hungarianOrdinalize } from "../utils/ordinalize";
|
|
3
|
+
import KinshipTranslatorBasic from "./kinship-translator.basic";
|
|
4
|
+
import { InLawsHu, casesHu, parentRelationsHu } from "./patterns.hu";
|
|
5
|
+
export default class KinshipTranslatorHU extends KinshipTranslatorBasic {
|
|
6
|
+
directPrefix(l) {
|
|
7
|
+
const level = l === undefined ? Math.abs(this.pathN?.level ?? 0) : l;
|
|
8
|
+
if (level <= 1) {
|
|
9
|
+
return "";
|
|
10
|
+
}
|
|
11
|
+
if (level === 2) {
|
|
12
|
+
return "nagy";
|
|
13
|
+
}
|
|
14
|
+
if (level === 3) {
|
|
15
|
+
return "déd";
|
|
16
|
+
}
|
|
17
|
+
if (level === 4) {
|
|
18
|
+
return "ük";
|
|
19
|
+
}
|
|
20
|
+
if (level === 5) {
|
|
21
|
+
return "szép";
|
|
22
|
+
}
|
|
23
|
+
if (level === 6) {
|
|
24
|
+
return "ős";
|
|
25
|
+
}
|
|
26
|
+
return `${level - 5}. ős`;
|
|
27
|
+
}
|
|
28
|
+
caseReplacer(relation, to, from = "nominativus", mod = "$") {
|
|
29
|
+
let newRelation = relation;
|
|
30
|
+
Object.keys(casesHu[from]).forEach((c) => {
|
|
31
|
+
newRelation = newRelation.replace(new RegExp(`(?<word1>${c}(?<mod>${mod}))`), (m, ...rest) => {
|
|
32
|
+
const groups = rest[rest.length - 1];
|
|
33
|
+
const word = groups?.word1 || groups?.word2;
|
|
34
|
+
if (!word) {
|
|
35
|
+
return m;
|
|
36
|
+
}
|
|
37
|
+
const toReplace = casesHu[from][word.trim()][to];
|
|
38
|
+
return toReplace ? `${toReplace}${groups.mod || ""}` : m;
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
return newRelation;
|
|
42
|
+
}
|
|
43
|
+
indirect() {
|
|
44
|
+
let degree = Math.abs(this.pathN?.degree ?? 0);
|
|
45
|
+
if (degree > 0) {
|
|
46
|
+
degree = degree - 1;
|
|
47
|
+
}
|
|
48
|
+
if (degree === 1) {
|
|
49
|
+
return `unokatestvér`;
|
|
50
|
+
}
|
|
51
|
+
return `${hungarianOrdinalize(degree)}unokatestvér`;
|
|
52
|
+
}
|
|
53
|
+
removal() {
|
|
54
|
+
const level = this.pathN?.level ?? 0;
|
|
55
|
+
let degree = Math.abs(this.pathN?.degree ?? 0);
|
|
56
|
+
if (degree > 0) {
|
|
57
|
+
degree = degree - 1;
|
|
58
|
+
}
|
|
59
|
+
if (!degree || (Math.abs(level) >= 1 && Math.abs(level) <= 6)) {
|
|
60
|
+
return level < 0 ? this.nibling() : this.auncle();
|
|
61
|
+
}
|
|
62
|
+
return `${hungarianOrdinalize(degree)}unokatestvér ${level}x eltávolítva`;
|
|
63
|
+
}
|
|
64
|
+
auncle() {
|
|
65
|
+
const level = this.pathN?.level ?? 0;
|
|
66
|
+
const degree = Math.abs(this.pathN?.degree ?? 0);
|
|
67
|
+
let degreeString = degree > 1 ? hungarianOrdinalize(degree) : "";
|
|
68
|
+
if (degreeString) {
|
|
69
|
+
degreeString = `${degreeString}-`;
|
|
70
|
+
}
|
|
71
|
+
let prefix = this.directPrefix();
|
|
72
|
+
const origPrefix = prefix;
|
|
73
|
+
if (level === 2) {
|
|
74
|
+
prefix = "nagy-";
|
|
75
|
+
}
|
|
76
|
+
if (this.personN?.isMale()) {
|
|
77
|
+
return `${degreeString}${prefix}nagybácsi`;
|
|
78
|
+
}
|
|
79
|
+
if (this.personN?.isFemale()) {
|
|
80
|
+
return `${degreeString}${prefix}nagynéni`;
|
|
81
|
+
}
|
|
82
|
+
return `${origPrefix}szülő ${degreeString ? `${degreeString}unoka` : ""}testvére`;
|
|
83
|
+
}
|
|
84
|
+
nibling() {
|
|
85
|
+
const level = Math.abs(this.pathN?.level ?? 0);
|
|
86
|
+
const degree = Math.abs(this.pathN?.degree ?? 0);
|
|
87
|
+
const ordinalized = degree > 1 ? hungarianOrdinalize(degree) : "";
|
|
88
|
+
let degreeString = ordinalized;
|
|
89
|
+
if (degreeString) {
|
|
90
|
+
degreeString = `${degreeString}-`;
|
|
91
|
+
}
|
|
92
|
+
const prefix = this.directPrefix(level + 1);
|
|
93
|
+
const origPrefix = this.directPrefix();
|
|
94
|
+
if (this.personN?.isMale()) {
|
|
95
|
+
return `${degreeString}${level === 1 ? origPrefix : prefix}unokaöcs`;
|
|
96
|
+
}
|
|
97
|
+
if (this.personN?.isFemale()) {
|
|
98
|
+
return `${degreeString}${level === 1 ? origPrefix : prefix}unokahúg`;
|
|
99
|
+
}
|
|
100
|
+
if (level <= 1) {
|
|
101
|
+
return `${ordinalized ? `${ordinalized}unoka` : ""}testvér gyermeke`;
|
|
102
|
+
}
|
|
103
|
+
return `${ordinalized ? `${ordinalized}unoka` : ""}testvér ${origPrefix.replace(/nagy$/, "")}unokája`;
|
|
104
|
+
}
|
|
105
|
+
parent() {
|
|
106
|
+
const prefix = this.directPrefix();
|
|
107
|
+
if (this.personN?.isMale()) {
|
|
108
|
+
return `${prefix}apa`;
|
|
109
|
+
}
|
|
110
|
+
if (this.personN?.isFemale()) {
|
|
111
|
+
return `${prefix}anya`;
|
|
112
|
+
}
|
|
113
|
+
return `${prefix}szülő`;
|
|
114
|
+
}
|
|
115
|
+
child() {
|
|
116
|
+
const level = Math.abs(this.pathN?.level ?? 0);
|
|
117
|
+
if (level <= 1) {
|
|
118
|
+
return "gyermek";
|
|
119
|
+
}
|
|
120
|
+
const prefix = this.directPrefix();
|
|
121
|
+
return `${prefix.replace(/nagy$/, "")}unoka`;
|
|
122
|
+
}
|
|
123
|
+
sibling() {
|
|
124
|
+
const parents1 = this.person1?.getBiologicalParents();
|
|
125
|
+
const parentsN = this.personN?.getBiologicalParents();
|
|
126
|
+
const inter = parents1?.intersection(parentsN);
|
|
127
|
+
// TODO if both has one parent in tree, this returns with an invalid/unsure half-blood state
|
|
128
|
+
if (!inter || inter.length < 2) {
|
|
129
|
+
return "féltestvér";
|
|
130
|
+
}
|
|
131
|
+
return "testvér";
|
|
132
|
+
}
|
|
133
|
+
spouse() {
|
|
134
|
+
if (this.personN?.isMale()) {
|
|
135
|
+
return "férj";
|
|
136
|
+
}
|
|
137
|
+
if (this.personN?.isFemale()) {
|
|
138
|
+
return "feleség";
|
|
139
|
+
}
|
|
140
|
+
return "házastárs";
|
|
141
|
+
}
|
|
142
|
+
ofSpouse(relation) {
|
|
143
|
+
if (!relation) {
|
|
144
|
+
return "";
|
|
145
|
+
}
|
|
146
|
+
const spouse = this.path?.[1].indi;
|
|
147
|
+
let spouseType = "házastárs";
|
|
148
|
+
if (spouse?.isMale()) {
|
|
149
|
+
spouseType = "férj";
|
|
150
|
+
}
|
|
151
|
+
if (spouse?.isFemale()) {
|
|
152
|
+
spouseType = "feleség";
|
|
153
|
+
}
|
|
154
|
+
return `${spouseType} ${this.caseReplacer(relation, "possessivus")}`;
|
|
155
|
+
}
|
|
156
|
+
spouseOf(relation) {
|
|
157
|
+
if (!relation) {
|
|
158
|
+
return "";
|
|
159
|
+
}
|
|
160
|
+
const spouse = this.path?.[this.path.length - 1].indi;
|
|
161
|
+
let spouseType = "házastársa";
|
|
162
|
+
if (spouse?.isMale()) {
|
|
163
|
+
spouseType = "férje";
|
|
164
|
+
}
|
|
165
|
+
if (spouse?.isFemale()) {
|
|
166
|
+
spouseType = "felesége";
|
|
167
|
+
}
|
|
168
|
+
return `${this.caseReplacer(relation, "nominativus", "possessivus")} ${spouseType}`;
|
|
169
|
+
}
|
|
170
|
+
of(relation) {
|
|
171
|
+
const formattedName = nameFormatter(this.path?.[0]?.indi, {
|
|
172
|
+
nameOrder: "last-first",
|
|
173
|
+
});
|
|
174
|
+
let name = formattedName.inOrder.filter(Boolean).join(" ");
|
|
175
|
+
if (this.displayName === "none") {
|
|
176
|
+
name = "";
|
|
177
|
+
}
|
|
178
|
+
else if (this.displayName === "givenname") {
|
|
179
|
+
name = formattedName.givenname;
|
|
180
|
+
}
|
|
181
|
+
else if (this.displayName === "surname") {
|
|
182
|
+
name = `${formattedName.surname}`;
|
|
183
|
+
}
|
|
184
|
+
const isSpouse = this.path?.[1].kinship === "spouse" ||
|
|
185
|
+
this.path?.[this.path.length - 1].kinship === "spouse";
|
|
186
|
+
if (!name || !relation) {
|
|
187
|
+
return relation ?? "";
|
|
188
|
+
}
|
|
189
|
+
if (isSpouse) {
|
|
190
|
+
return `${name} ${this.caseReplacer(this.caseReplacer(relation, "dativus", "nominativus", " "), "possessivus")}`;
|
|
191
|
+
}
|
|
192
|
+
return `${name} ${this.caseReplacer(this.caseReplacer(relation, "possessivus", "nominativus", " "), "possessivus")}`;
|
|
193
|
+
}
|
|
194
|
+
inLaw(relation) {
|
|
195
|
+
let inLawRelation = relation;
|
|
196
|
+
Object.keys(InLawsHu).find((pattern) => {
|
|
197
|
+
const regex = new RegExp(`(?<space> )(?<word1>${pattern})$|^(?<word2>${pattern.replace("?<mod1>", "?<mod2>")})$`);
|
|
198
|
+
if (relation?.match(regex)) {
|
|
199
|
+
inLawRelation = relation?.replace(regex, (m, ...rest) => {
|
|
200
|
+
const groups = rest[rest.length - 1];
|
|
201
|
+
const word = groups?.word1 || groups?.word2;
|
|
202
|
+
const mod = groups?.mod1 || groups?.mod2;
|
|
203
|
+
if (!word) {
|
|
204
|
+
return m;
|
|
205
|
+
}
|
|
206
|
+
let toReplace = InLawsHu[word.trim()] || InLawsHu[pattern];
|
|
207
|
+
if (typeof toReplace === "function") {
|
|
208
|
+
toReplace = toReplace(this.personN) ?? "";
|
|
209
|
+
}
|
|
210
|
+
return toReplace
|
|
211
|
+
? `${groups.space || ""}${mod || ""}${toReplace}`
|
|
212
|
+
: m;
|
|
213
|
+
});
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
return false;
|
|
217
|
+
});
|
|
218
|
+
return inLawRelation ?? "";
|
|
219
|
+
}
|
|
220
|
+
relationType(relation) {
|
|
221
|
+
if (!relation || !this.pathN?.relation) {
|
|
222
|
+
return relation ?? "";
|
|
223
|
+
}
|
|
224
|
+
return `${parentRelationsHu[this.pathN.relation]} ${relation}`;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type Kinship = "self" | "spouse" | "child" | "parent";
|
|
2
|
+
interface IKinshipTranslator {
|
|
3
|
+
isOfSpouse: boolean;
|
|
4
|
+
isSpouseOf: boolean;
|
|
5
|
+
displayName: "none" | "givenname" | "surname" | "all";
|
|
6
|
+
parent: () => string | undefined;
|
|
7
|
+
child: () => string | undefined;
|
|
8
|
+
sibling: () => string | undefined;
|
|
9
|
+
spouse: () => string | undefined;
|
|
10
|
+
indirect: () => string | undefined;
|
|
11
|
+
removal: () => string | undefined;
|
|
12
|
+
inLaw: (relation?: string) => string | undefined;
|
|
13
|
+
ofSpouse: (relation?: string) => string | undefined;
|
|
14
|
+
spouseOf: (relation?: string) => string | undefined;
|
|
15
|
+
relationType: (relation?: string) => string | undefined;
|
|
16
|
+
of: (relation?: string) => string | undefined;
|
|
17
|
+
}
|
|
18
|
+
export default IKinshipTranslator;
|
|
19
|
+
//# sourceMappingURL=kinship-translator.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kinship-translator.interface.d.ts","sourceRoot":"","sources":["../../src/kinship-translator/kinship-translator.interface.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;AAC7D,UAAU,kBAAkB;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,GAAG,KAAK,CAAC;IAEtD,MAAM,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAEjC,KAAK,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAEhC,OAAO,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAElC,MAAM,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAEjC,QAAQ,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAEnC,OAAO,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAElC,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAEjD,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAEpD,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAEpD,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAExD,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAC9C;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as translators from "./translators";
|
|
2
|
+
export default class KinshipTranslator {
|
|
3
|
+
constructor(person1, person2, lang = "en", entirePath, displayName = "givenname") {
|
|
4
|
+
this.displayName = displayName;
|
|
5
|
+
this.lang = lang;
|
|
6
|
+
this.entirePath = entirePath;
|
|
7
|
+
this.person1 = person1;
|
|
8
|
+
this.person2 =
|
|
9
|
+
typeof person2 === "string"
|
|
10
|
+
? this.person1.getGedcom()?.indi(person2)
|
|
11
|
+
: person2;
|
|
12
|
+
this.path = this.person1.path(this.person2);
|
|
13
|
+
if (translators[lang]) {
|
|
14
|
+
this.translator = new translators[lang](this.path ?? [], displayName);
|
|
15
|
+
}
|
|
16
|
+
// Fallback
|
|
17
|
+
if (!this.translator) {
|
|
18
|
+
// eslint-disable-next-line new-cap
|
|
19
|
+
this.translator = new translators.en(this.path ?? [], displayName);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
get path0() {
|
|
23
|
+
return this.path?.[0];
|
|
24
|
+
}
|
|
25
|
+
get path1() {
|
|
26
|
+
return this.path?.[1];
|
|
27
|
+
}
|
|
28
|
+
get pathM() {
|
|
29
|
+
return this.path?.[this.path.length - 2];
|
|
30
|
+
}
|
|
31
|
+
get pathN() {
|
|
32
|
+
return this.path?.[this.path.length - 1];
|
|
33
|
+
}
|
|
34
|
+
direct() {
|
|
35
|
+
if (this.pathN?.level === 0 && this.pathN.degree === 0) {
|
|
36
|
+
return this.translator?.spouse();
|
|
37
|
+
}
|
|
38
|
+
if (this.pathN?.level === 0 && this.pathN.degree === 1) {
|
|
39
|
+
return this.translator?.sibling();
|
|
40
|
+
}
|
|
41
|
+
if ((this.pathN?.level ?? 0) > 0 && this.pathN?.degree === 0) {
|
|
42
|
+
return this.translator?.parent();
|
|
43
|
+
}
|
|
44
|
+
if ((this.pathN?.level ?? 0) < 0 && this.pathN?.degree === 0) {
|
|
45
|
+
return this.translator?.child();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
indirect() {
|
|
49
|
+
return this.translator?.indirect();
|
|
50
|
+
}
|
|
51
|
+
removal() {
|
|
52
|
+
return this.translator?.removal();
|
|
53
|
+
}
|
|
54
|
+
translate(showMainPerson) {
|
|
55
|
+
if (this.entirePath) {
|
|
56
|
+
const path = this.path?.map((path, index) => ({
|
|
57
|
+
id: path.indi.id,
|
|
58
|
+
gen: path.level,
|
|
59
|
+
absolute: this.person1.kinship(path.indi.id, showMainPerson, this.lang, false, this.displayName),
|
|
60
|
+
relative: this.path?.[index - 1]?.indi.kinship(path.indi.id, showMainPerson, this.lang, false, this.displayName),
|
|
61
|
+
}));
|
|
62
|
+
return path;
|
|
63
|
+
}
|
|
64
|
+
const person1 = this.path0;
|
|
65
|
+
const person2 = this.path1;
|
|
66
|
+
const personM = this.pathM;
|
|
67
|
+
const personN = this.pathN;
|
|
68
|
+
if (!person1 || !person2 || !personM || !personN) {
|
|
69
|
+
return "";
|
|
70
|
+
}
|
|
71
|
+
if (person2.kinship === "spouse" &&
|
|
72
|
+
person2.indi.id !== personN.indi.id) {
|
|
73
|
+
this.translator && (this.translator.isOfSpouse = true);
|
|
74
|
+
}
|
|
75
|
+
else if (personN.kinship === "spouse" &&
|
|
76
|
+
person2.indi.id !== personN.indi.id) {
|
|
77
|
+
this.translator && (this.translator.isSpouseOf = true);
|
|
78
|
+
}
|
|
79
|
+
let relation;
|
|
80
|
+
if (personN.degree === 0 ||
|
|
81
|
+
(personN.degree === 1 && personN.level === 0)) {
|
|
82
|
+
relation = this.direct();
|
|
83
|
+
}
|
|
84
|
+
else if (personN.level === 0) {
|
|
85
|
+
relation = this.indirect();
|
|
86
|
+
}
|
|
87
|
+
else if (personN.level !== 0) {
|
|
88
|
+
relation = this.removal();
|
|
89
|
+
}
|
|
90
|
+
relation = this.translator?.relationType(relation);
|
|
91
|
+
if (this.translator?.isOfSpouse) {
|
|
92
|
+
relation = this.translator?.ofSpouse(relation);
|
|
93
|
+
}
|
|
94
|
+
else if (this.translator?.isSpouseOf) {
|
|
95
|
+
relation = this.translator?.spouseOf(relation);
|
|
96
|
+
}
|
|
97
|
+
relation = this.translator?.inLaw(relation);
|
|
98
|
+
if (showMainPerson && relation) {
|
|
99
|
+
relation = this.translator?.of(relation);
|
|
100
|
+
}
|
|
101
|
+
return relation ?? "";
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patterns.de.d.ts","sourceRoot":"","sources":["../../src/kinship-translator/patterns.de.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAe3C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const InLawsDe = {
|
|
2
|
+
"Ehepartner von (kind|tochter|sohn)": "Schwiegerkind",
|
|
3
|
+
"Ehefrau von (kind|tochter|sohn)": "Schwiegertochter",
|
|
4
|
+
"Ehemann von (kind|tochter|sohn)": "Schwiegersohn",
|
|
5
|
+
"mutter des (Ehepartner|Ehefrau|Ehemann)s": "Schwiegermutter",
|
|
6
|
+
"vater des (Ehepartner|Ehefrau|Ehemann)s": "Schwiegervater",
|
|
7
|
+
"elternteil des (Ehepartner|Ehefrau|Ehemann)s": "Schwiegerelternteil",
|
|
8
|
+
"Ehefrau von (Halb)?(geschwister|schwester|bruder)": "Schwägerin",
|
|
9
|
+
"Ehemann von (Halb)?(geschwister|schwester|bruder)": "Schwager",
|
|
10
|
+
"Ehepartner von (Halb)?(geschwister|schwester|bruder)": "Schwager/Schwägerin",
|
|
11
|
+
"(Halb)?schwester des (Ehepartner|Ehefrau|Ehemann)s": "Schwägerin",
|
|
12
|
+
"(Halb)?bruder des (Ehepartner|Ehefrau|Ehemann)s": "Schwager",
|
|
13
|
+
"(Halb)?geschwister des (Ehepartner|Ehefrau|Ehemann)s": "Schwager/Schwägerin",
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patterns.en.d.ts","sourceRoot":"","sources":["../../src/kinship-translator/patterns.en.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAa3C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const InLawsEn = {
|
|
2
|
+
"spouse of (child|daughter|son)": "child-in-law",
|
|
3
|
+
"wife of (child|daughter|son)": "daughter-in-law",
|
|
4
|
+
"husband of (child|daughter|son)": "son-in-law",
|
|
5
|
+
"mother of (spouse|wife|husband)": "mother-in-law",
|
|
6
|
+
"father of (spouse|wife|husband)": "father-in-law",
|
|
7
|
+
"parent of (spouse|wife|husband)": "parent-in-law",
|
|
8
|
+
"wife of (half-)?(sibling|sister|brother)": "sister-in-law",
|
|
9
|
+
"husband of (half-)?(sibling|sister|brother)": "brother-in-law",
|
|
10
|
+
"spouse of (half-)?(sibling|sister|brother)": "sibling-in-law",
|
|
11
|
+
"(half-)?sister of (spouse|wife|husband)": "sister-in-law",
|
|
12
|
+
"(half-)?brother of (spouse|wife|husband)": "brother-in-law",
|
|
13
|
+
"(half-)?sibling of (spouse|wife|husband)": "sibling-in-law",
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patterns.es.d.ts","sourceRoot":"","sources":["../../src/kinship-translator/patterns.es.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAa3C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const InLawsEs = {
|
|
2
|
+
"cónyuge de (hijo/hija|hija|hijo)": "yerno/nuera",
|
|
3
|
+
"esposa de (hijo/hija|hija|hijo)": "nuera",
|
|
4
|
+
"esposo de (hijo/hija|hija|hijo)": "yerno",
|
|
5
|
+
"madre del (cónyuge|esposa|esposo)": "suegra",
|
|
6
|
+
"padre del (cónyuge|esposa|esposo)": "suegro",
|
|
7
|
+
"padre/madre del (cónyuge|esposa|esposo)": "suegro/suegra",
|
|
8
|
+
"esposa de (medio )?(hermano/hermana|hermana|hermano)": "cuñada",
|
|
9
|
+
"esposo de (medio )?(hermano/hermana|hermana|hermano)": "cuñado",
|
|
10
|
+
"cónyuge de (medio )?(hermano/hermana|hermana|hermano)": "cuñado/cuñada",
|
|
11
|
+
"(medio )?hermana del (cónyuge|esposa|esposo)": "cuñada",
|
|
12
|
+
"(medio )?hermano del (cónyuge|esposa|esposo)": "cuñado",
|
|
13
|
+
"(medio )?hermano/hermana del (cónyuge|esposa|esposo)": "cuñado/cuñada",
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patterns.fr.d.ts","sourceRoot":"","sources":["../../src/kinship-translator/patterns.fr.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAa3C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const InLawsFr = {
|
|
2
|
+
"conjoint de (enfant|fille|fils)": "beau-fils/belle-fille",
|
|
3
|
+
"épouse de (enfant|fille|fils)": "belle-fille",
|
|
4
|
+
"mari de (enfant|fille|fils)": "gendre",
|
|
5
|
+
"mère du (conjoint|épouse|mari)": "belle-mère",
|
|
6
|
+
"père du (conjoint|épouse|mari)": "beau-père",
|
|
7
|
+
"parent du (conjoint|épouse|mari)": "beau-parent",
|
|
8
|
+
"épouse de (demi-)?(frère/sœur|sœur|frère)": "belle-sœur",
|
|
9
|
+
"mari de (demi-)?(frère/sœur|sœur|frère)": "beau-frère",
|
|
10
|
+
"conjoint de (demi-)?(frère/sœur|sœur|frère)": "beau-frère/belle-sœur",
|
|
11
|
+
"(demi-)?sœur du (conjoint|épouse|mari)": "belle-sœur",
|
|
12
|
+
"(demi-)?frère du (conjoint|épouse|mari)": "beau-frère",
|
|
13
|
+
"(demi-)?frère/sœur du (conjoint|épouse|mari)": "beau-frère/belle-sœur",
|
|
14
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type IndiType } from "../classes/indi";
|
|
2
|
+
import { type CrossCases } from "./types";
|
|
3
|
+
export declare const parentRelationsHu: Record<string, string>;
|
|
4
|
+
export declare const casesHu: CrossCases;
|
|
5
|
+
export declare const InLawsHu: Record<string, string | ((indi?: IndiType) => string | undefined)>;
|
|
6
|
+
//# sourceMappingURL=patterns.hu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patterns.hu.d.ts","sourceRoot":"","sources":["../../src/kinship-translator/patterns.hu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,KAAK,UAAU,EAAkB,MAAM,SAAS,CAAC;AAE1D,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAMpD,CAAC;AA4EF,eAAO,MAAM,OAAO,EAAE,UAIrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,MAAM,CAC5B,MAAM,EACN,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,QAAQ,KAAK,MAAM,GAAG,SAAS,CAAC,CAsBlD,CAAC"}
|