make sure properties exist

This commit is contained in:
Erik 2022-01-12 23:40:25 +02:00
parent 3e8f3e7d9c
commit e5cc109895
No known key found for this signature in database
GPG Key ID: FEFF4B220DDF5589

View File

@ -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);