mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-05 23:47:03 +03:00
Bugfix: translator "undefined"
This commit is contained in:
parent
3a36094be7
commit
ca59c21602
1 changed files with 5 additions and 4 deletions
|
|
@ -14,15 +14,16 @@ export const trigger = ko.observable(false);
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export function i18n(key, valueList, defaulValue) {
|
export function i18n(key, valueList, defaulValue) {
|
||||||
let path = key.split('/'),
|
let path = key.split('/');
|
||||||
result = I18N_DATA[path[0]][path[1]] || defaulValue || key;
|
if (!I18N_DATA[path[0]] || !path[1]) {
|
||||||
|
return defaulValue || key;
|
||||||
|
}
|
||||||
|
let result = I18N_DATA[path[0]][path[1]] || defaulValue || key;
|
||||||
if (valueList) {
|
if (valueList) {
|
||||||
Object.entries(valueList).forEach(([key, value]) => {
|
Object.entries(valueList).forEach(([key, value]) => {
|
||||||
result = result.replace('%' + key + '%', value);
|
result = result.replace('%' + key + '%', value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue