Open thlcodes opened 2 years ago
I am having the same problem when relying on default namespace with react and i18next frameworks: š§© Enabled frameworks: i18next, React, General
.
As a workaround, the namespace should be specified explicitly when translating.
@thlcodes You spelled userTranslation
in the issue title. Could you rename to useTranslation
so that your issue is easier to find?
@thlcodes @Arnaud-J Thanks for showing the namespace workaround. I switched from next-i18next to next-translate and couldn't find a fix for the i18n-ally extension problem.
Seems to me that a similar issue has been fixed in src/frameworks/i18next.ts using getScopeRange
in addition to @Arnaud-J suggestion for explicit namespace declaration I had to specify also the path to my locales in i18n-ally.localesPaths
settings and manually select only json
as "Enabled Parser" as suggested in this other issue on the plugin repo https://github.com/lokalise/i18n-ally/issues/816
so instead of
const { t } = useTranslation('dashboard');
I have to explicitly declare the full namespace in the function
t("dashboard.errors.required")
it will be nice to leverage on default namespace
I used https://github.com/lokalise/i18n-ally/issues/307 as a guide and have created this feature for next-translate. I don't know TS and have never worked on a VSCode extension before so not sure if there are issues. I've done some testing and it works as I expect it to. Please take a look at my fork and let me know if there are any glaring issues. If not I'll issue a pull request.
https://github.com/lokalise/i18n-ally/commit/6ed5ad49427f09247752ad94dae07658fffb4f8d
This seems to affect react-i18next too.
Hi folks š!
First of all: great tool! Keep up the good work!
When I try to use i18n Ally in combination with
next-translate
and useuseTranslation
with a default namespace (e.g. "foo"), I getAs far as I get that *should work, right?
Cheers, Thomas
Extension Version i18n Ally v2.8.1
Framework/i18n package you are using next-translate 1.4.0
To Reproduce Steps to reproduce the behavior:
Device Infomation
Extension Log Go to
View
->Output
->i18n Ally
, and paste the content below. You should mask any sensitive informationScreenshots
EDIT: what of cause is hidden in the screenshot (by the error message):