mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 16:35:53 +02:00
[GH-ISSUE #730] Missing translation in web app #534
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#534
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @codebude on GitHub (May 15, 2023).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/730
🐞 Describe the bug
In the web app, there's a part (Account -> Attachment storage -> subheading) which doesn't seem connected to the localization engine. I use the German UI, but the text is still English. Weblate says, that all texts (100%) are translated for German. Thus I assume, that the part isn't linked correctly with the "translation engine".
It is this text: https://hosted.weblate.org/translate/ntfy/web/de/?q=expiry&sort_by=-priority%2Cposition&checksum=
💻 Components impacted
💡 Screenshots and/or logs

🔮 Additional context
{expiry}part isn't translated correctly.{expiry}part is translated correctly.@binwiederhier commented on GitHub (May 15, 2023):
I looked at this briefly, thinking it was going to be an easy fix, but it turns out that I think I may have messed up some of the i18n stuff, or at least I'm not understanding it well enough. I believe your locale is set as
de-DEorde-ATor similar, and my language files are only calledde.json. The same problem exists with English anden-US, etc.Long story short, it's not loading the correct language because
i18n.languageis set tode-DEinstead ofde. The language detection stuff apparently does fall back fromde-DEtode, but I don't know how to get to that variable (yet).@codebude commented on GitHub (May 15, 2023):
Thanks for investigating the error. I also tried to understand what is happening, but I'm not sure I got it.
I think the problem is this part here:
github.com/binwiederhier/ntfy@04b7b4284a/web/src/components/Account.js (L393)The
i18n.languageseems to be incorrect here. As far as I understand, humanizeDuration expects the code of the translation file (in your case two-letter, e.g.) buti18n.languagecontains the detected code (de-DE). That's in general/for i18next no problem, because it knows that it should fallback from de-DE to de, but as far as I can see, the humanize-duration module doesn't.If I read the i18n documentation correct, than
i18n.resolvedLanguageshould work here.So rewriting the Account.js code to the following might be a solution:
@binwiederhier commented on GitHub (May 15, 2023):
Oh maaaan, I should have read your comment first. Because you solved it the same way I eventually did, except that I did my own research when I didn't have to. Good thing we came to the same conclusion.
Fixed in
github.com/binwiederhier/ntfy@f998d4d2adThanks for reporting, and for the solution!
@codebude commented on GitHub (May 16, 2023):
You're welcome...
...und viele Grüße aus der Heimat. ;-)