[de][pronouns] make slashes work

This commit is contained in:
Andrea Vos 2021-08-19 17:56:21 +02:00
parent af1d94dc36
commit 2f48f4ca8b
2 changed files with 23 additions and 18 deletions

View File

@ -15,7 +15,7 @@ pronouns:
examples: ['er&sie', 'er&dey', 'sie&xier'] examples: ['er&sie', 'er&dey', 'sie&xier']
null: false null: false
emoji: false emoji: false
slashes: true slashes: ['pronoun_n', 'possessive', 'pronoun_d', 'pronoun_a']
avoiding: false avoiding: false
others: 'Andere Pronomen' others: 'Andere Pronomen'

View File

@ -72,23 +72,28 @@ export const buildPronoun = (pronouns, path) => {
} }
const p = path.split('/').filter(s => !!s); const p = path.split('/').filter(s => !!s);
if (!pronoun && process.env.CONFIG.pronouns.slashes !== false && p.length === MORPHEMES.length) { if (!pronoun && process.env.CONFIG.pronouns.slashes !== false) {
pronoun = new Pronoun( const slashMorphemes = process.env.CONFIG.pronouns.slashes === true
`${p[0]}/${p[1]}`, ? MORPHEMES
'', : process.env.CONFIG.pronouns.slashes;
false, if (p.length === slashMorphemes.length) {
buildDict(function*() { pronoun = new Pronoun(
let i = 0; `${p[0]}/${p[1]}`,
for (let m of MORPHEMES) { '',
yield [m, p[i++]]; false,
} buildDict(function*() {
}), for (let m of MORPHEMES) {
[ p[p.length - 1].endsWith('selves') ], // TODO English specific, extract somewhere const index = slashMorphemes.indexOf(m)
[ false ], yield [m, index === -1 ? '' : p[index]];
[], }
'__generator__', }),
false, [ p[p.length - 1].endsWith('selves') ], // TODO English specific, extract somewhere
) [ false ],
[],
'__generator__',
false,
)
}
} }
return pronoun; return pronoun;