mirror of
https://github.com/FranP-code/shopping-discord-bot.git
synced 2025-10-13 00:22:44 +00:00
refactoring and adding limit command option
This commit is contained in:
12
scripts/generateLocalizedResponses.js
Normal file
12
scripts/generateLocalizedResponses.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const { responsesTexts } = require('../utils/constants');
|
||||
|
||||
function generateLocalizedResponses(userLanguage) {
|
||||
const responsesEntries = Object.entries(responsesTexts);
|
||||
const localizatedResponses = {};
|
||||
responsesEntries.forEach(([responseName, responseTexts]) => {
|
||||
localizatedResponses[responseName] = Object.entries(responseTexts).find(responseText => responseText[0] === userLanguage)[1];
|
||||
});
|
||||
return localizatedResponses;
|
||||
}
|
||||
|
||||
module.exports = generateLocalizedResponses;
|
||||
Reference in New Issue
Block a user