Project

General

Profile

Actions

Task #3583

closed

No longer possible to overwrite translated strings using wlc

Added by Sophie Gautier almost 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Category:
Weblate
Target version:
Team - Q2/2022
Start date:
Due date:
% Done:

0%

Tags:

Description

Reported by Mikhel, I open a ticket to better track the issue:
-------------------------------
Overwriting existing translations still fails for me, both with wlc and
curl. Example commands:

wlc --key "<my API key from Weblate>" --url "
https://translations.documentfoundation.org/api/" upload --input
"master/libo_ui/svl/messages.po" --overwrite --method translate
"libo_ui-master/svlmessages/et"

curl -s -X POST -F method=translate -F overwrite=true -F
conflict=replace-translated -F file=@"master/libo_ui/svl/messages.po" -
H "authorization: Token <my API key>"
https://translations.documentfoundation.org/api/translations/libo_ui-master/svlmessages/et/file/

{"not_found":0,"skipped":19,"accepted":0,"total":19,"result":false,"count":19}

Previously untranslated or fuzzy strings get updated as expected.
--------------------------------
Archive of the mail
https://listarchives.libreoffice.org/global/l10n/2022/msg00146.html

Christian Lohmaier: could you have a look at what could go wrong?

Actions #1

Updated by Christian Lohmaier almost 2 years ago

  • Target version set to Q2/2022

The old wlc bug was diagnoes to be a change in the API way back https://docs.weblate.org/en/latest/api.html#post--api-translations-(string-project)-(string-component)-(string-language)-file-
→ the "conflict" (resolution strategy) flag needs to be set to "replace-translated"
That has been an API change way back for version 4.2 already.

The curl example uses the new flag, but also uses the no longer used overwrite parameter, not sure whether that causes some trouble. Sample file would have been nice...

response includes "skipped" with all strings - need to do some own testing...

Actions #2

Updated by Mihkel Tõnnov almost 2 years ago

Thank you for looking into this, Christian.

For curl, the "overwrite" parameter doesn't seem to make a difference, but inspecting the upload page, I realised the parameter name should've been "conflicts" (plural):
curl -s -X POST -F method=translate -F conflicts=replace-translated -F file=@"master/libo_ui/svl/messages.po" -H "authorization: Token <my API key>" https://translations.documentfoundation.org/api/translations/libo_ui-master/svlmessages/et/file/ did the trick:

{"not_found":0,"skipped":18,"accepted":1,"total":19,"result":true,"count":19}

As for wlc (1.13), it doesn't accept "--conflict" as an argument: wlc --key <my API key> --url "https://translations.documentfoundation.org/api/" upload --input "master/libo_ui/svl/messages.po" --method translate --conflict replace-translated "libo_ui-master/svlmessages/et" returns:

usage: wlc [-h] [--format {text,csv,json,html}] [--version] [--debug] [--config CONFIG] [--config-section CONFIG_SECTION] [--key KEY] [--url URL]
           {version,list-projects,list-components,list-languages,list-translations,show,delete,ls,commit,push,pull,reset,cleanup,repo,changes,stats,lock-status,lock,unlock,download,upload} ...
wlc: error: unrecognized arguments: --conflict

Similar result with "--conflicts replace-translated" and just "--replace-translated".

Also tried with "--overwrite replace-translated" which returned:

Error: Object not found on the server (maybe operation is not supported on the server)

Anyway, at least curl works now -- and I can live with that :)
Thanks again!

Actions #3

Updated by Christian Lohmaier over 1 year ago

  • Status changed from New to Resolved

wfm if it wfy :-)

Actions #4

Updated by Florian Effenberger over 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF