Skip to content

Conversation

acolomb
Copy link
Member

@acolomb acolomb commented Dec 17, 2022

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 the gui/default/assets/lang/ directory.

Based on the transifexdl.go script.  Map Weblate language codes to the
existing ones during import.  Do not delete incomplete languages from
repo.
Copy link
Member

@imsodin imsodin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 62 to 63
if pct < 75 || !curValidLangs[code] && pct < 95 {
log.Printf("Language %q too low completion ratio %d%%", code, pct)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you not continuing here?

Copy link
Member Author

@acolomb acolomb Jan 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 == "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@imsodin
Copy link
Member

imsodin commented Jan 8, 2023

And for convenience I'd add a weblate command just like the the transifex one in the build.go, to preserve that common entrypoint for scripts.

@acolomb
Copy link
Member Author

acolomb commented Jan 8, 2023

And for convenience I'd add a weblate command just like the the transifex one in the build.go, to preserve that common entrypoint for scripts.

Right, did that already on the other branch, but copied here now.

@acolomb
Copy link
Member Author

acolomb commented Jan 8, 2023

Thanks for the review!

@acolomb acolomb merged commit 39c0bfa into syncthing:main Jan 8, 2023
@acolomb acolomb deleted the weblate-download branch January 11, 2023 11:14
calmh added a commit to calmh/syncthing that referenced this pull request Jan 23, 2023
* 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
  ...
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Jan 8, 2024
@syncthing syncthing locked and limited conversation to collaborators Jan 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants