forked from Galactic/galactic-bot
make sure properties exist
This commit is contained in:
parent
3e8f3e7d9c
commit
e5cc109895
@ -25,8 +25,9 @@ class LocaleLoader {
|
||||
|
||||
format(language, index, parameters = {}, code = false) {
|
||||
|
||||
if (!this.languages[language]) return `< Missing Locale: ${language} >`;
|
||||
let string = this.languages[language][index];
|
||||
if(!string) return `< Missing Locale: ${language}.${index} >`;
|
||||
if(!string) return `< Missing Locale Index: ${language}.${index} >`;
|
||||
|
||||
for(const [ parameter, value ] of Object.entries(parameters)) {
|
||||
string = string.replace(new RegExp(Util.escapeRegex(`{${parameter.toLowerCase()}}`), 'giu'), value);
|
||||
|
Loading…
Reference in New Issue
Block a user