hedy icon indicating copy to clipboard operation
hedy copied to clipboard

💻 stop copying over English content in Weblate

Open Felienne opened this issue 1 year ago • 5 comments

It is not always clear to teachers untranslated content is shown when they see English content, it would be nice if we can show an icon or something (or a different color) if a content block is equal to English (tested with a text equivalence)

Felienne avatar Feb 28 '24 13:02 Felienne

Hi all (esp @boryanagoncharenko and @jpelay are relevant for this)!

My proposal is as follows, stepwise

  • We change the default setting of Weblate to copy over content, and figure out what happens then (empty files? no files? placeholders?)
  • In our code, detect if there is no file or whatever weblate does and catch it. For now, we can just show our English version. This does not change a lot right away, but is immediately better than what we have now, because in the current situation, if we update English, the copied files do not get updates, so a lot of languages have some outdated, previously copied over content in them.

When that is done, we can decide if we, as originally suggested in this issue, want to highlight the untranslated content, only for teachers or for everyone.

But let's get this piggy washed first! (this is a Dutch saying)

Felienne avatar Aug 28 '24 09:08 Felienne

The way to copy content from one language to another is done through using an add-on called Prefill translation with source. When it is disabled and a new language is added, Weblate creates empty yaml files and a complete and correct .po file without any translations (see image below). As a side note, now we know why in the past we got generated PRs with empty yaml files - it happened because the prefill add-on did not do its job on time.

Screenshot 2024-09-18 at 14 07 32

Another aspect of the missing prefill add-on is that the components cannot be translated in the Weblate interface. Since they are empty yaml files, no content is offered to translators. See the image below:

Screenshot 2024-09-18 at 14 00 10

Based on the current behavior, I guess we need to have a template yaml file that contains keys, but not values. If this file is used in the prefill, translators would see what they need to translate but untranslated the values would not be filled.

boryanagoncharenko avatar Sep 18 '24 11:09 boryanagoncharenko

Regarding the first issue, it seems that Weblate has a setting "Template for new translations" which can be set to the Monolingual base language file https://docs.weblate.org/en/latest/admin/projects.html#component-new-base. When a new language is added, the keys will be extracted from this file but only the present translations will be added as values.

About the second issue, it is very suspicious. I managed to replicate it once with my personal account (in trial). The issue went away after I tried to add a key that is already present.

boryanagoncharenko avatar Sep 18 '24 13:09 boryanagoncharenko

Adding the Xhosa language broke Weblate, so that all the components showed no strings for translation. I am not sure if I an just incredibly unlucky with the Weblate console or I am doing anything wrong with it.

Thankfully, adding the Oromo language worked as normal. This time I added the language to a single component and replied on the add-on to replicate the the language to the other components.

boryanagoncharenko avatar Sep 19 '24 13:09 boryanagoncharenko

Adding the Xhosa language broke Weblate, so that all the components showed no strings for translation. I am not sure if I an just incredibly unlucky with the Weblate console or I am doing anything wrong with it.

Thankfully, adding the Oromo language worked as normal. This time I added the language to a single component and replied on the add-on to replicate the the language to the other components.

I am not sure of the cause but in some cases new languages, esp rare ones, because they are not supported by PyBabel. Maybe that was the cause here?

In some cases we had to make special exceptions, like here: https://github.com/hedyorg/hedy/blob/e522f412ba3b49a2b6a05506a2fc069b17e53798/hedy_content.py#L32

Especially if you say all does worl for Oromo, maybe that was the cause?

Hope this helps!

Felienne avatar Sep 19 '24 17:09 Felienne

Closing in favor of #5907

boryanagoncharenko avatar Oct 31 '24 20:10 boryanagoncharenko