Skip to content

Conversation

acolomb
Copy link
Member

@acolomb acolomb commented Feb 24, 2023

Requested on Weblate.

@acolomb acolomb changed the title gui: Add Croatian (hr) translation template. gui: Add Croatian (hr) translation template Feb 24, 2023
@acolomb acolomb linked an issue Feb 24, 2023 that may be closed by this pull request
@acolomb acolomb enabled auto-merge (squash) February 24, 2023 07:32
@calmh
Copy link
Member

calmh commented Feb 24, 2023

I'm confused; why do we need to add this? (Also, even if we do this doesn't satisfy the "translate to croatian" issue it would close, so I think that may be misguided.)

@calmh
Copy link
Member

calmh commented Feb 24, 2023

OK I understand this is how we add languages now. Does the file need all the keeps and English phrases? It would be clearer to me that it was a template if it were empty, for example, and I assume the contents doesn't really matter as the keys and phrases to translate should come from the English source?

@acolomb
Copy link
Member Author

acolomb commented Feb 24, 2023

We currently have the option on Weblate set to not allow anyone to add arbitrary languages. Instead the admins get notified and this is how we heed the request.

You're right, we should probably reword the issue or just close it because the language is not guaranteed to actually end up in the next release. I just thought it might be nice to mention in the release notes if it does manage to get in.

@calmh
Copy link
Member

calmh commented Feb 24, 2023

I just thought it might be nice to mention in the release notes if it does manage to get in.

I agree; just not sure how to manage that except remembering to do it manually somehow.

@acolomb
Copy link
Member Author

acolomb commented Feb 24, 2023

If we added it with empty translations, Weblate would fill them in automatically anyway. And I think it is required for the fallback to English to work, no? Would the JS translation framework actually use a different language if the chosen one does not satisfy the requested term? Or does it fall back because we actually do have all untranslated strings in there with the English phrase?

@acolomb acolomb disabled auto-merge February 24, 2023 08:34
@acolomb
Copy link
Member Author

acolomb commented Feb 24, 2023

So apparently it does fall back to English when the chosen language has no entry for the string. That actually allows us to use the JSON files more sensibly. To stay compatible with the way Transifex did things, I set it up to insert the English string for untranslated stuff. But actually not having the keys for untranslated strings in a language file at all makes more sense, as then the information what parts are translated and which strings just happen to be identical (like "LAN") can be deduced from looking at the JSON files alone. Right now this state is only available within Weblate's internal database.

I guess we can try what happens when adding this file simply as an empty JSON object. But we'll need to disable the auto-fill behavior on Weblate first. If that works, I guess we can remove untranslated entries from other language files as well in a follow-up. What do you think @calmh?

@calmh
Copy link
Member

calmh commented Feb 24, 2023

Honestly I think the exported files from Weblate should contain the English values for untranslated strings. It may be that we currently show the key if there is no matching entry for a given language, and that happens to be English, but ideally we'd have more machine readable keys and then that approach is bad.

It's just that in this manuever we're adding something where it looks like the keys/values might be relevant: "this is what should be translated", while adding an empty file (or empty json object) would better illustrate to me what's going on -- creating a placeholder for translation to be imported into...

@acolomb
Copy link
Member Author

acolomb commented Feb 24, 2023

I think you misunderstood. The GUI falls back to the "en" locale for keys not contained in the chosen language's JSON file. It does not show the key itself. Tested with the theme-name-dark key for example, when removing that from a language file, it will fall back to "Dark", the English translation.

This is probably the effect of:

LocaleServiceProvider.setDefaultLocale('en');

As for the handling in Weblate, it is definitely cleaner to keep out untranslated strings. As it is right now, they will be added, but set to "needs-editing" state instead of what it should be, the "empty" state. It effectively pre-occupies the needs-editing state that otherwise would be available to mark "fuzzy" or "unsure" translations. Using that as intended would help when people want to search and filter stuff. E.g. to get the current set of strings without the English dummies, you'd use this filter:

state:>=translated OR (state:needs-editing AND NOT check:same)

where it should be only:

state:>empty

@calmh calmh merged commit 49c56b8 into syncthing:main Feb 24, 2023
calmh added a commit to imsodin/syncthing that referenced this pull request Mar 10, 2023
* main: (46 commits)
  build: Update dependencies
  lib/api: Expose `blocksHash` in file info (syncthing#8810)
  gui, man, authors: Update docs, translations, and contributors
  lib/discover: Don't leak relay-tokens to discovery (syncthing#8762)
  gui, man, authors: Update docs, translations, and contributors
  gui: Add Croatian (hr) translation template (syncthing#8801)
  build(deps): bump github.com/quic-go/quic-go from 0.32.0 to 0.33.0 (syncthing#8800)
  cmd/stupgrades: Cache should apply to HEAD as well as GET
  build: Add more GitHub Actions
  gui: Remove non-existent customicons.css file reference (fixes syncthing#8797) (syncthing#8798)
  Only fail after chmod error if permissions differ (e.g. on config file) (syncthing#8771)
  gui, man, authors: Update docs, translations, and contributors
  build: Use Go 1.19.6 for Windows
  build: Update dependencies
  gui, man, authors: Update docs, translations, and contributors
  gui: Remove duplicate Spanish (Spain) translation (fixes syncthing#8781) (syncthing#8782)
  gui: Add xattr filter editor (fixes syncthing#8660) (syncthing#8734)
  gui: Switch to Weblate for translations (syncthing#8777)
  all: Use new Go 1.19 atomic types (syncthing#8772)
  gui, man, authors: Update docs, translations, and contributors
  ...
@acolomb acolomb deleted the translate-hr branch March 10, 2023 15:17
calmh added a commit to tomasz1986/syncthing that referenced this pull request Mar 18, 2023
* main: (424 commits)
  gui, man, authors: Update docs, translations, and contributors
  lib/protocol: Cache expensive key operations (fixes syncthing#8599) (syncthing#8820)
  gui: Add Persian (fa) translation template (syncthing#8822)
  lib: Correctly handle encrypted trailer size (fixes syncthing#8556) (syncthing#8563)
  gui: Disable Restore Versions filters when no versioned files exist (fixes syncthing#5408) (syncthing#8539)
  build(deps): bump github.com/chmduquesne/rollinghash from 0.0.0-20180912150627-a60f8e7142b5 to 4.0.0+incompatible (syncthing#8804)
  build: Update dependencies (syncthing#8821)
  lib/api: Expose `blocksHash` in file info (syncthing#8810)
  gui, man, authors: Update docs, translations, and contributors
  lib/discover: Don't leak relay-tokens to discovery (syncthing#8762)
  gui, man, authors: Update docs, translations, and contributors
  gui: Add Croatian (hr) translation template (syncthing#8801)
  build(deps): bump github.com/quic-go/quic-go from 0.32.0 to 0.33.0 (syncthing#8800)
  cmd/stupgrades: Cache should apply to HEAD as well as GET
  build: Add more GitHub Actions
  gui: Remove non-existent customicons.css file reference (fixes syncthing#8797) (syncthing#8798)
  Only fail after chmod error if permissions differ (e.g. on config file) (syncthing#8771)
  gui, man, authors: Update docs, translations, and contributors
  build: Use Go 1.19.6 for Windows
  build: Update dependencies
  ...
@acolomb
Copy link
Member Author

acolomb commented Mar 22, 2023

@calmh I didn't see your approval emoji on the last comment until now. Does that mean you're OK to go ahead and remove the untranslated strings from JSON files? I have a PR almost ready for it, would finish that if you approve.

@calmh
Copy link
Member

calmh commented Mar 22, 2023

Yes, sure

@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 Feb 24, 2024
@syncthing syncthing locked and limited conversation to collaborators Feb 24, 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.

gui: Translate to Croatian
3 participants