How to set all strings as needing review in weblate?

Bonjour,

After a string is translated, one can optionally tick the “Needs review” flag. Since all strings translated for the first time need review before they can be merged, is there a way to make that the default ?

Cheers

https://docs.weblate.org/en/latest/admin/translating.html#additional-information-on-source-strings seems to have something

the add-review flag is exactly what we need only have to find how to make that the default now.

https://docs.weblate.org/en/weblate-2.14.1/admin/checks.html#custom-checks explains where to set that globally:

You can fine tune checks for each source string (in source strings review, see Additional information on source strings) or in the Component configuration (Quality checks flags),

just adding the add-review string and voila !

Hum, it looks like this is not set consistently. Maybe it will be good for newly added strings but not for the one that already exists in the database ? The display looks inconsistent with the need-review flag but … the Need review checkbox is not ticked ? This was a string not translated yet, I translated, clicked saved and at no stage of this did the Need review flag changed. I must be missing something…

Yes, this flag affects only strings which are seen by Weblate for first time, so it won’t change anything for the past strings.

Thanks for the confirmation :slight_smile: Is there a way to set the Need review flag globally for all existing strings ? It would be useful for our use case, even if it means a SQL request.

@nijel FWIW the documentation is clear. I just had trouble thinking about review in terms of flags. Once I got that right, the rest was straight forward.

For the record I tried something like running the following in zen mode for French

(function(d) {
  var input = d.querySelectorAll('input[type="checkbox"]');
  var i = input.length;

  while (i--) {
    if (input[i].checked == false) {
       input[i].click();
    }
  }    
})(this.document);

And in the end I lost most of the strings (just in french). Not a good idea at all, don’t try that.

A better option is probably to use the http://docs.weblate.org/en/latest/api.html

I looked for examples but did not find any, I guess I’ll have to experiment

The wlc client is a good start.

Hum, using the API won’t work because it would require updating a unit obtained via /api/unit/XXX but it is not implemented yet.

$ curl     -H "Authorization: Token AUIb9VeMWpBnxqlL4aunHa18IYkWeqht0IqS8Qaf"     https://weblate.securedrop.club/api/units/2350/ | jq .
{
  "translation": "http://weblate.securedrop.club/api/translations/securedrop/securedrop/fr/",
  "source": "Please wait at least {seconds} seconds before logging in again.",
  "previous_source": "",
  "target": "Vous êtes prié d'attendre {seconds} secondes avant de tenter une nouvelle connexion.",
  "id_hash": 447419996279869200,
  "content_hash": 447419996279869200,
  "location": "journalist.py:122",
  "context": "",
  "comment": "",
  "flags": "",
  "fuzzy": true,
  "translated": true,
  "position": 3,
  "has_suggestion": false,
  "has_comment": false,
  "has_failing_check": false,
  "num_words": 10,
  "priority": 100,
  "id": 2350,
  "web_url": "https://weblate.securedrop.club/translate/securedrop/securedrop/fr/?checksum=86358e1db7ab0f14",
  "url": "http://weblate.securedrop.club/api/units/2350/",
  "source_info": "http://weblate.securedrop.club/api/sources/97/"
}

Ended up setting the fuzzy field in the database with:

$ sudo docker-compose exec database bash
$ env | grep POSTG # to get the credentials
$ psql -U weblate -h database -d weblate
weblate=# update trans_unit set fuzzy = true;
UPDATE 1917

The Need review field is designed to mark all strings that were imported / translated outside of weblate and imported via git. And it is cleared as soon as the string is translated (or when the translation is modified).

What we need is exactly the opposite: Need review should be set whenever a string is translated (or when the translation is modified). A reviewer would then know that this translated string needs her/his attention, proofread the translation and clear the flag, if and only if the translation is good.

@nijel do you know if there is a way to implement this workflow ?

Not really like now. The problem is that the review process works a bit differently for every project, so implementing it properly is not really that straightforward. But this is certainly something we would like to include in future.

1 Like