Partial translation display #2408

Closed
opened 2019-02-02 18:12:28 +01:00 by Fozar · 4 comments
Fozar commented 2019-02-02 18:12:28 +01:00 (Migrated from github.com)

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.

# 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.](https://imgur.com/a/OC3f9T7) #### 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.
Tobotimus commented 2019-02-19 22:25:43 +01:00 (Migrated from github.com)

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

Thanks for opening this issue. I'll try to look closer for a cause when I get the chance.
Tobotimus commented 2019-02-25 08:03:14 +01:00 (Migrated from github.com)

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.

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: ```po #: 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: ```po #: 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.
Fozar commented 2019-02-28 07:42:47 +01:00 (Migrated from github.com)

Hope for a quick fix:)

Hope for a quick fix:)
Tobotimus commented 2019-03-04 00:21:38 +01:00 (Migrated from github.com)

Looks like I've got a solution 😁
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
Looks like I've got a solution :grin: ![image](https://user-images.githubusercontent.com/7438501/53703544-3d268900-3e67-11e9-9822-1fc959dd653a.png) 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 ```
Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot#2408
No description provided.