Discord Bot Language

Any idea of how I can build a discord bot in 2 languages?? For example Romanian and English.

I would probably add a !setup command. And it would ask the language, and saved to a DB of some sort and put it as 1 or 2 or 3 etc. For example, 1 would be english, 2 would be Romainian, 3 would be spanish. And when a command is ran you get the languge id (1,2,3 etc. ) and put the strings in the the google translate API then take the response and send it.

I mean, if you know the languages you don’t need the API. You would save the guild ID in the database along with the country (I would do country codes like GB, but it’s your choice) and then do an if statement in the message function or whatever to check the guild ID in the language. Otherwise, if you don’t want the whole guild to be one language, you could make each command have a language parameter (e.g. !command GB) and then do an if statement for that

Look into localization libraries and store in a database each user’s preferences.
try https://www.npmjs.com/package/i18n
it might be used in the chrome browser even

I would do per user. Because some people are from certainh countries but don’t speak the language, and that can get racist. So I would say per user so that they can set the prefrence to what they want.

1 Like