mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-22 07:46:17 -04:00
add default values to Localization.getTranslation function
This commit is contained in:
parent
d689fe28e5
commit
02911804cb
2 changed files with 3 additions and 3 deletions
|
@ -42,7 +42,7 @@ class Localization {
|
||||||
|
|
||||||
static async setLocale(newLocale) {
|
static async setLocale(newLocale) {
|
||||||
if (newLocale === Localization.locale) return false;
|
if (newLocale === Localization.locale) return false;
|
||||||
|
|
||||||
Localization.defaultTranslations = await Localization.fetchTranslationsFor(Localization.defaultLocale);
|
Localization.defaultTranslations = await Localization.fetchTranslationsFor(Localization.defaultLocale);
|
||||||
|
|
||||||
const newTranslations = await Localization.fetchTranslationsFor(newLocale);
|
const newTranslations = await Localization.fetchTranslationsFor(newLocale);
|
||||||
|
@ -94,7 +94,7 @@ class Localization {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static getTranslation(key, attr, data, useDefault=false) {
|
static getTranslation(key, attr=null, data={}, useDefault=false) {
|
||||||
const keys = key.split(".");
|
const keys = key.split(".");
|
||||||
|
|
||||||
let translationCandidates = useDefault
|
let translationCandidates = useDefault
|
||||||
|
|
|
@ -94,7 +94,7 @@ class Localization {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static getTranslation(key, attr, data, useDefault=false) {
|
static getTranslation(key, attr=null, data={}, useDefault=false) {
|
||||||
const keys = key.split(".");
|
const keys = key.split(".");
|
||||||
|
|
||||||
let translationCandidates = useDefault
|
let translationCandidates = useDefault
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue