How to localize a bot?
-
Like an abuse like this:
if(guild.language == "Ru") { // Functions for Rus } if(guild.language == "En") { // Functions for Eng }
Make normal localization?JavaScript Anonymous, Feb 20, 2019 -
Alternatively, you can do this:
phrases: {
sayHi: {
ru: 'Привет',
en: 'Hello',
//... и тд
},
}
.on('message', (m) => {
let lang = m.guild.language;
m.replay(phrases.sayHi[lang]);
});Anna Bird -
I solved this problem with a self-written module.
https://www.npmjs.com/package/msg-localizeAnonymous
3 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!