Closed codebude closed 1 year ago
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-DE
or de-AT
or similar, and my language files are only called de.json
. The same problem exists with English and en-US
, etc.
Long story short, it's not loading the correct language because i18n.language
is set to de-DE
instead of de
. The language detection stuff apparently does fall back from de-DE
to de
, but I don't know how to get to that variable (yet).
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:
https://github.com/binwiederhier/ntfy/blob/04b7b4284abac53205ec5bb3be006d07f529b661/web/src/components/Account.js#L393
The i18n.language
seems to be incorrect here. As far as I understand, humanizeDuration expects the code of the translation file (in your case two-letter, e.g.) but i18n.language
contains 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.resolvedLanguage
should work here.
So rewriting the Account.js code to the following might be a solution:
expiry: humanizeDuration(account.limits.attachment_expiry_duration * 1000, {
language: i18n.resolvedLanguage,
fallbacks: ["en"]
})
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 https://github.com/binwiederhier/ntfy/commit/f998d4d2adc4f582035eb37cf0537eb2d0b1e272
Thanks for reporting, and for the solution!
You're welcome... ...und viele Grüße aus der Heimat. ;-)
:lady_beetle: 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=
:computer: Components impacted
:bulb: Screenshots and/or logs
:crystal_ball: Additional context
{expiry}
part isn't translated correctly.{expiry}
part is translated correctly.