h3poteto / fedistar

Multi-column Fediverse client for desktop
https://fedistar.net
GNU General Public License v3.0
128 stars 6 forks source link

i18next translation function return invalid function instead of string #804

Closed h3poteto closed 1 year ago

h3poteto commented 1 year ago

When I call the translation function

const { t } = useTranslation()

t("some.translation.key") // => function value() { [native code] }

Not always, but sometimes it happens when re-rendering. As a result, some words are not rendered.

Environment

OS: Manjaro Linux Version: master

Probably it is related to #673 . If I revert webkit2gtk, this issue is resolved.

tassoman commented 1 year ago

I think translation should be static inside a constant, before rendering, so that it's always available on runtime and never computed again. So that it just need to be read on rendering, something like render(i18n.it.timeline_title)

h3poteto commented 1 year ago

If so, when we change the translation (e.g. en -> it), the change is not reflected. We need to stop and restart the application.

tassoman commented 1 year ago

My option was to load all translated strings of all languages but can be expensive in terms of memory. Now there are only 3 languages but, maybe can't scale in the future. 🤔