twonirwana/DiscordDiceBot

I want to add a localization to Brazillian Portuguese

igorteuri opened this issue · 11 comments

Hi there!

Loved your work here! Amazing bot.

I wanted to translate the commands to add localization to Brazillian Portuguese, but I haven`t found a lang folder or localization files.
Would it be something possible to do?

Thanks and great that you want to contribute. You are correct, currently there is no localization and all text is hard coded.
There are two separated areas that could be localized.

  1. The commands, help text etc. This would need some work for me to put everything in localization files and get the prefered user language from discord. Give me some time and i can set it up. Afterwards you can translate the english file to brazilian portuguese and then everything should be translated for you.
  2. The dice expression. This can't be translated like the rest because the evaluation of the dice expression works inside a lib and adding localization there would be a major rework. But it would be possible to use alias to translate the dice expression (for example se -> if). For convenience it would be possible to add a command that adds all aliases for a language to a discord channel. The only drawback is that if you the bot provides the dice expression in the answer, it will always show the english version.
    Do you see one of them as more important? I can start working an the setup for 1, but it will take a few weeks for me.

Thanks! I think the first option would already be a great way to promote accessibility to brazilian players.
The sentences like "Click a button to roll the dice".

I see that the syntax itself might not be a problem, because it is nested inside the button, and the button can have its flag in Portuguese. I might translate the documention, this way the even if the syntax is in english, people could understand.

top, i started with the implementation. I now think a localization of the dice expressions is also possible but that would be a second step. I am optimistic that i can give you next week a file with all the text to translate.

Still doing tests and quality checks but here is the file for the translation: https://github.com/twonirwana/DiscordDiceBot/blob/3871ada10d2cf43f36fa2eae83aee0264173b5ee/bot/src/main/resources/botMessages.properties

you need only to translate the part right from the =. Some text have length or character limitations, i grouped the texted after there type and added the information for the limitations before each group. You don't need to translate everything, comment out everything you don't translate with #, then the fallback is english.

Let me also know if you find improvements for the english text.

Let me know if you need help and let me know how it works for you. I will asked soon in the discord server for other contributors for other language.

Already started the translation, thanks.

I don't need to translate the commands, right?
In this case, for instance
Write '/welcome start' or '/quickstart system' to use pre-made RPG commands
I wouldn't translate the /welcome start and the other commands, right?

Do I have to rename the file in a specific format? Do I send it here for you?

Oh, I got it. There's alias for the comands in the new language down below.
image

So I'll have to use the same command names that I used for the commands, right?

You need only to translate the part right from = and not the key.
You can translate the base commands, but i don't know if that is necessary or helpful.
Here is the german translation file: https://github.com/twonirwana/DiscordDiceBot/blob/3871ada10d2cf43f36fa2eae83aee0264173b5ee/bot/src/main/resources/botMessages_de.properties
Simply post your file here (or make a pull request)

Here's the file translated to Brazillian Portuguese, or "Português Brasileiro". The language code is pt-BR.

I had to change the extension to .txt in order to send it here.
botMessages.properties.txt

@igorteuri

Great, that was fast.
Two small problems:

custom_parameter.description=Preencha um parametro personalizade de uma determinada formula e role-o quando todos os parâmetros forem fornecidos
is to long. Discord limits the command descriptions to 100 characters

channel_config.option.channel_alias.name=apelido_do_canal
channel_config.option.user_channel_alias.name=apelido_do_canal
they are the same but channel_config.option.user_channel_alias.name is the alias for a single user in a channel and channel_config.option.user_channel_alias.name is a alias for all user in a channel

What name/link/email should I use for mention your contribution?

Thanks for the feedback. Fixed it.

pt-BR-botMessages.properties.txt

Once the language is implemented, the bot will selectd the proper language based on server's language, or do I have to set the language with a command?

Thanks for the feedback. Fixed it.

pt-BR-botMessages.properties.txt

Once the language is implemented, the bot will selectd the proper language based on server's language, or do I have to set the language with a command?

Most server have no language (only community server can set a default language). The bot will use the discord client language as default but you can overrule it with a option in the commands