Repository navigation
script: Add weblatedl.go for downloading updated translations - #8723
Conversation
Based on the transifexdl.go script. Map Weblate language codes to the existing ones during import. Do not delete incomplete languages from repo.
imsodin
left a comment
There was a problem hiding this comment.
Just one relevant comment where I don't get the logic, other two are optional nits.
Also all the copy-pasted code shows the downsides of this one-directory with all scripts and no building approach. Anyway, other options have downsides too and definitely not something to change here.
| if pct < 75 || !curValidLangs[code] && pct < 95 { | ||
| log.Printf("Language %q too low completion ratio %d%%", code, pct) |
There was a problem hiding this comment.
Why are you not continuing here?
There was a problem hiding this comment.
That's a difference between the fundamental data models in Weblate and Transifex. Weblate syncs from the upstream repo and expects any changed translations to get merged there at some point in time. Be it via automated pull requests (as configured right now on my branch), or via importing and committing the JSON via script. It then rebases any outstanding translation updates on top of the updated upstream branch.
If we skipped the rest of the loop here, incomplete languages would simply never get their changes integrated upstream. Regardless of completion state, the current JSON file should always be versioned upstream. The Transifex script actually deletes incomplete files, which would drop the languages from Weblate completely - not what we want.
There was a problem hiding this comment.
Ah yeah right. We just don't write it to that prettyprint.js file and thus it's ignored in the UI.
| func main() { | ||
| log.SetFlags(log.Lshortfile) | ||
|
|
||
| if t := authToken(); t == "" { |
There was a problem hiding this comment.
Completely nitty and optional: I'd just get the token from env here and keep the variable around, and then pass it to req - no function needed.
|
And for convenience I'd add a |
Right, did that already on the other branch, but copied here now. |
|
Thanks for the review! |
* main: (69 commits) Handle relay connect timeout (fixes syncthing#8749) (syncthing#8755) gui, man, authors: Update docs, translations, and contributors build: Go 1.19.5 gui, man, authors: Update docs, translations, and contributors script: Add weblatedl.go for downloading updated translations (syncthing#8723) gui: Allow to translate action and type in Recent Changes modal (syncthing#8548) gui, man, authors: Update docs, translations, and contributors gui: Fix undefined lastSeenDays error in disconnected-inactive status check (ref syncthing#8530) (syncthing#8730) gui, man, authors: Update docs, translations, and contributors gui, api: Indicate running under container (syncthing#8728) lib/fs: Use io/fs errors as recommended in std lib (syncthing#8726) build: Handle co-authors (ref syncthing#3744) (syncthing#8708) lib/fs: Watching is unsupported on android/amd64 (fixes syncthing#8709) (syncthing#8710) lib/model: Only log at info level if setting change time fails (syncthing#8725) lib/model: Don't lower rescan interval from default on auto accepted enc folder (fixes syncthing#8572) (syncthing#8573) gui, man, authors: Update docs, translations, and contributors gui: Remove unmaintained language variant nl-BE (syncthing#8722) gui, script: Fix indentation in lang-en.json to match others (syncthing#8721) docker: Ensure entrypoint is executable (syncthing#8719) Go 1.19.4 ...
Based on the transifexdl.go script. Map Weblate language codes to the existing ones during import. Do not delete incomplete languages from repo.
Note this requires an API token from Weblate to use, passed via
WEBLATE_TOKEN. It needs to be run from thegui/default/assets/lang/directory.