updated lang

This commit is contained in:
2022-02-13 19:51:30 -06:00
parent 343ed640ae
commit ab76d7edbc
2 changed files with 36 additions and 2 deletions

10
dist/lang.js vendored
View File

@@ -47,6 +47,14 @@ var Lang;
throw 'language id does not exist';
}
Lang.setLang = setLang;
function template(str, args) {
return str.replace(/{\w+}/g, str => {
let key = str.substring(1, str.length - 1);
if (key in args)
return args[key];
return key;
});
}
/**
* reads language json
* @param id ex: discord.error.noActiveQueue
@@ -59,7 +67,7 @@ var Lang;
if (key in finding) {
let found = finding[key];
if (typeof found === 'string')
return found;
return template(found, args);
finding = found;
}
else