hedy icon indicating copy to clipboard operation
hedy copied to clipboard

[CONTENT] Request: avoid duplicate strings in text to be translated

Open mgmalheiros opened this issue 2 years ago • 5 comments

I am slowly updating and completing the Brazilian Portuguese translation, and I noticed many repeated strings in content/commands/en.yaml:

For example, all theses lines appear two or more times, but each time they generate a separate translation entry:

  2     example: "Example: color {is} {ask} 'What is your favorite color?'"
  2     example: "Example: {if} color {is} green {print} 'pretty!' {else} {print} 'meh'"
  2     example: "Example: name {is} Hedy."
  2     example: "name = 'Hedy'"
  2     example: "{print}"
  2     explanation: "ask for the answer to a sum and check if it is correct. We can now print 2 lines."
  2     explanation: "print something. Remember to use a quotation mark for literal printing."
  2     explanation: "{repeat} multiple lines"
  2 -   name: "{is}"
  3     demo_code: "{print} '5 times 5 is ' 5 * 5"
  3     demo_code: "{print} 'Hello welcome to Hedy.'"
  3     example: "Example: {print} '5 times 5 is ' 5 * 5"
  3     example: "Example: {print} 'Hello welcome to Hedy.'"
  3     explanation: "Make a choice with `{if}`"
  3 -   name: "{if}"
  4     demo_code: |
  4     explanation: "ask something with `{ask}`."
  4     explanation: "print exactly using quotation marks"
  8 -   name: "{ask}"
  9 -   name: "{print}"

I think this probably applies to other parts of Hedy too...

Would it be possible to merge all these duplicates into a single string to translate? Or is it handled in a wide configuration option like this one?

mgmalheiros avatar Jun 15 '22 23:06 mgmalheiros

Hi @mgmalheiros! Thanks for you contribution on Hedy! For strings that occur in multiple places or multiples times we use Babel to keep track of translations, also see the CONTRIBUTING.md guidelines. However, as pointed out by you this isn't always the case for the commands YAML files (and probably others as well).

@Mark-Giesen do you know if you can implement this into our Weblate configuration?

TiBiBa avatar Jun 16 '22 07:06 TiBiBa

Thanks for the pointer @mgmalheiros! I think the real issue here might be that the content is not really correct, we don't want to have duplicate entries in the explanations, but in some cases, we were a bit lazy while adding commands and then this was copied over in other languages (and in some cases later fixed in En)

(the following is more of a conversation with myself, haha) It is also a result of the fact that we never really made a good design decision for the commands. Are they all commands in a level or are they only the new ones... We never truly decided and now the content has become a bit mixed and then was duplicated in many languages making it harder to streamline now)

Felienne avatar Jun 16 '22 07:06 Felienne

In short: I don't think this needs a technical/Weblate solution, but a good content solution!

Felienne avatar Jun 16 '22 07:06 Felienne

In the Babel (gettext) method the sourcestring is the key of a translation, so that is unique. In the YAML method the key of a string has the position where it is used. The fact that we need this structure is why we use YAML still. Some duplications might be solved with better content solutions (like commands YAML), but I think separating structure and text would solve all. Not an easy fix though.

Mark-Giesen avatar Jun 16 '22 08:06 Mark-Giesen

Thank you for the kind and detailed feedback!

No problem at all, I was hoping for a more straightforward fix for the string duplication.

For me it is ok to close this issue, waiting for a better moment to tackle this problem.

mgmalheiros avatar Jun 17 '22 00:06 mgmalheiros