[pl][pronouns] add unaccented and prep – BC fixes

This commit is contained in:
Andrea Vos 2023-02-11 15:41:45 +01:00
parent 4da995f044
commit 999b0a320b

View File

@ -67,23 +67,21 @@ export const buildPronoun = (pronouns, path) => {
base = base.merge(pronounsWithAliases[option]) base = base.merge(pronounsWithAliases[option])
} }
} }
if (base) { let baseArray = base ? base.toArray() : null;
base = base.toArray();
}
// i know, it's ugly… didn't think about BC much and now it's a huge mess… // i know, it's ugly… didn't think about BC much and now it's a huge mess…
const pronounStrLen = pronounStr.map(x => x.startsWith('!') ? parseInt(x.substring(1)) : 1).reduce((c, a) => c + a, 0); const pronounStrLen = pronounStr.map(x => x.startsWith('!') ? parseInt(x.substring(1)) : 1).reduce((c, a) => c + a, 0);
if (config.locale === 'pl' && base && pronounStrLen < 30) { if (config.locale === 'pl' && baseArray && pronounStrLen < 30) {
base = [ baseArray = [
...base.slice(0, 4), ...baseArray.slice(0, 4),
base[5], baseArray[5],
base[8], baseArray[8],
...base.slice(11) ...baseArray.slice(11)
]; ];
} }
let pronoun = pronounStr.length === 1 let pronoun = pronounStr.length === 1
? base ? base
: Pronoun.from(Compressor.uncompress(pronounStr, base, config.locale)); : Pronoun.from(Compressor.uncompress(pronounStr, baseArray, config.locale));
if (!config) { if (!config) {
return pronoun; return pronoun;