mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-23 16:26:17 -04:00
fix translation fallback for sparely translated languages when complete categories are missing
This commit is contained in:
parent
c2a746d69c
commit
abc06fcc21
2 changed files with 28 additions and 16 deletions
|
@ -76,18 +76,24 @@ class Localization {
|
|||
? Localization.defaultTranslations
|
||||
: Localization.translations;
|
||||
|
||||
for (let i=0; i<keys.length-1; i++) {
|
||||
translationCandidates = translationCandidates[keys[i]]
|
||||
}
|
||||
let translation;
|
||||
|
||||
let lastKey = keys[keys.length-1];
|
||||
try {
|
||||
for (let i = 0; i < keys.length - 1; i++) {
|
||||
translationCandidates = translationCandidates[keys[i]]
|
||||
}
|
||||
|
||||
if (attr) lastKey += "_" + attr;
|
||||
let lastKey = keys[keys.length - 1];
|
||||
|
||||
let translation = translationCandidates[lastKey];
|
||||
if (attr) lastKey += "_" + attr;
|
||||
|
||||
for (let j in data) {
|
||||
translation = translation.replace(`{{${j}}}`, data[j]);
|
||||
translation = translationCandidates[lastKey];
|
||||
|
||||
for (let j in data) {
|
||||
translation = translation.replace(`{{${j}}}`, data[j]);
|
||||
}
|
||||
} catch (e) {
|
||||
translation = "";
|
||||
}
|
||||
|
||||
if (!translation) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue