support for emoji formatting

This commit is contained in:
Erik 2022-01-13 21:46:47 +02:00
parent 60012a12c1
commit 0491dee1f8
No known key found for this signature in database
GPG Key ID: FEFF4B220DDF5589

View File

@ -3,6 +3,7 @@ const fs = require('fs');
const chalk = require('chalk');
const Util = require('../../Util.js');
const { Emojis } = require('../../constants/index.js');
class LocaleLoader {
@ -29,6 +30,8 @@ class LocaleLoader {
let string = this.languages[language][index];
if (!string) return `< Missing Locale Index: ${language}.${index} >`;
for (const emoji of Object.keys(Emojis)) parameters[`emoji_${emoji}`] = Emojis[emoji];
for(const [ parameter, value ] of Object.entries(parameters)) {
string = string.replace(new RegExp(Util.escapeRegex(`{${parameter.toLowerCase()}}`), 'giu'), value);
}