N
N
Nikita Kudrin2020-10-18 17:17:33
JavaScript
Nikita Kudrin, 2020-10-18 17:17:33

How to localize a bot?

How to abuse like this:

if(guild.language == "Ru") {
// Functions for Rus
}
if(guild.language == "En") {
// Functions for Eng
}

Make a normal localization?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2020-10-18
@HepkaPlay

Alternatively, you can do this:

phrases: {
  sayHi: {
    ru: 'Привет',
    en: 'Hello',
    //... и тд
  },
}

.on('message', (m) => {
  let lang = m.guild.language;
  
  m.replay(phrases.sayHi[lang]);
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question