Red-discordbot: Partial translation display

Created on 2 Feb 2019  ·  4Comments  ·  Source: Cog-Creators/Red-DiscordBot

Other bugs

What were you trying to do?

I translated several files into Russian on crowdin. I downloaded them and replaced the files on my server. I did not make any more changes on the server. Then I changed the language to Russian (!set locale ru-RU).

What were you expecting to happen?

I expected that all the cogs that I translated will be in Russian. Module files are fully translated, I checked everything myself.

What actually happened?

In fact, the translation is only partially displayed. For example, when I call for !help, I see that some of the points are in English, and some in Russian. It is observed in almost all cogs.

Here you can see clearly.

How can we reproduce this issue?

  1. Install clear redbot on ubuntu.
  2. Download, for example, core cog with my 100% translation from crowdin.
  3. Replace ru-RU file from /core/locales/ru-RU.po with my translation
  4. Change bot language to Russian
  5. Type !help, press enter

My observations

I think that the problem is multi-line, as I noticed in this pattern. Although I had a small sample.

i18n Needs Info Bug

Most helpful comment

Looks like I've got a solution :grin:
image

See #2504. If you have the updatered cog installed, you can install and test with:

[p]urlupdate https://github.com/Cog-Creators/Red-DiscordBot/tarball/refs/pull/2408/head#egg=Red-DiscordBot

All 4 comments

Thanks for opening this issue. I'll try to look closer for a cause when I get the chance.

I seem to have found the cause of the issue.

Crowdin is exporting its .po files slightly differently to how we format .pot files - which is the format we expect them to be in. Here's an example:

messages.pot for admin cog after extracting strings:

#: redbot/cogs/admin/admin.py:138
#, docstring
msgid ""
"Add a role to a user.\n"
"\n"
"        If user is left blank it defaults to the author of the command.\n"
"        "
msgstr ""

ru-RU.po for admin cog after building and downloading from Crowdin:

#: redbot/cogs/admin/admin.py:138
#, docstring
msgid "Add a role to a user.\n\n"
"        If user is left blank it defaults to the author of the command.\n"
"        "
msgstr "Добавляет роль пользователю.\n\n"
"        Если пользователь не указан, то по умолчанию используется отправитель.\n"
"        "

As you can see in the former snippet, starting a msgid with msgid "" indicates a multiline string. This is what we expect when parsing .po files. However Crowdin is exporting them with part of the string included on the first line.

I suppose we will need to update our .po parsing logic to recognise this format, unless there is some setting in Crowdin I'm unaware of.

Hope for a quick fix:)

Looks like I've got a solution :grin:
image

See #2504. If you have the updatered cog installed, you can install and test with:

[p]urlupdate https://github.com/Cog-Creators/Red-DiscordBot/tarball/refs/pull/2408/head#egg=Red-DiscordBot
Was this page helpful?
0 / 5 - 0 ratings

Related issues

xnaas picture xnaas  ·  3Comments

Vexed01 picture Vexed01  ·  3Comments

Sinnoma picture Sinnoma  ·  4Comments

IdkGoodName picture IdkGoodName  ·  3Comments

lifehome picture lifehome  ·  4Comments