incubateur-ademe / nosgestesclimat-site

Estimez votre empreinte climat - le code du site
https://nosgestesclimat.fr
MIT License
70 stars 40 forks source link

i18n : how to make sure previous human edits are not swallowed by automatic translation ? #775

Open laem opened 1 year ago

laem commented 1 year ago

Here, Helen made the en FAQ better. https://github.com/datagir/nosgestesclimat-site/commit/4300978b66cfa9fd8e29bb864f1339753086093c

The yarn translate:faq command erases these changes :/

That's a big problem for translation, since it asks the person who makes the next edits to be aware of the previous edits.

image

It looks like the "lock" mechanism didn't work here. But even if it did, I could have changed one word in an original text block, but Helen's edits are still completely relevant and should not be erased.

@EmileRolley What do you think about introducing the technique used by mon-entreprise.fr, prefixing all text blocks that are auto translated, in order to block auto-translation of all blocks where the annotation was removed ? E.g. with ~~.

EmileRolley commented 1 year ago

Indeed, the translation mangement is currently problematic as we mix automatic and handwritted ones.

A solution could be to postfix attributes with .auto for the ones automatically generated by the DeepL API. The workflow would consist of:

  1. Run the translate:* yarn command which will produce:
    
    - catégorie.auto: general
    catégorie.lock: général
    id: ges
    question: What is a carbon footprint? How is it that what I eat or my garbage
    can emits greenhouse gases (GHG)?
    question.lock: Qu'est-ce que l'empreinte carbone ? Comment se fait-il que ce que
    je mange ou que ma poubelle émettent des gaz à effet de serre (GES) ?
2. Then, a reviewer could fix the translation:
```yaml
- catégorie.auto: general
  catégorie.lock: général
  id: ges
  question.auto: What is a carbon footprint? How can my food or my garbage
    emit greenhouse gases (GHG)?
  question: What is a carbon footprint? How can my food or my garbage
    emit greenhouse gases (GHG)?
  question.lock: Qu'est-ce que l'empreinte carbone ? Comment se fait-il que ce que
    je mange ou que ma poubelle émettent des gaz à effet de serre (GES) ?
  1. Consequently, If the yarn translate:faq is run again only the reviewed translation will be backup under .previous_review but the new automatically generated translation will be shown:
    - catégorie.auto: general
    catégorie.lock: général
    id: ges
    question: What is a carbon footprint? 
    question.previous_review: What is a carbon footprint? How can my food or my garbage
    emit greenhouse gases (GHG)?
    question.lock: Qu'est-ce que l'empreinte carbone ?

What do you think about this method @laem and @Clemog?

Maybe using a tool like Crowdin could help to manage this kind of issue?

Clemog commented 1 year ago

@EmileRolley What do you think about introducing the technique used by mon-entreprise.fr, prefixing all text blocks that are auto translated, in order to block auto-translation of all blocks where the annotation was removed ? E.g. with ~~.

In this situation, if the block in french is changed, the block with ~~ won't be translated. I think your solution can overpass this @EmileRolley. One question : do we have to display a warning if the question.lock changes in case of previous_review attribute ?

EmileRolley commented 1 year ago

Yes, it should be done to alert the user to potentially correct the automatic translation :ok_hand:

Clemog commented 1 year ago

What would be the default translation ? question ?

EmileRolley commented 1 year ago

Yes we can define the order like: <attr> > <attr>.auto > <attr>.previous_review