Not able to load new namespace dynamically at client-side #2307
Unanswered
mikaelnguyenpg
asked this question in
Q&A
Replies: 1 comment
-
If you can't add it on server side: https://github.com/i18next/next-i18next?tab=readme-ov-file#5-declaring-locale-dependencies You need to load them like this: https://github.com/i18next/next-i18next?tab=readme-ov-file#client-side-loading-of-translations-via-http => https://github.com/i18next/i18next-http-backend/tree/master/example/next |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys, I did try the sample SSG of this library
![image](https://private-user-images.githubusercontent.com/176993881/393063728-6f7e441a-7aab-4adb-b7c4-e8f85f347aee.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MDUyNDYsIm5iZiI6MTczODkwNDk0NiwicGF0aCI6Ii8xNzY5OTM4ODEvMzkzMDYzNzI4LTZmN2U0NDFhLTdhYWItNGFkYi1iN2M0LWU4Zjg1ZjM0N2FlZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwN1QwNTA5MDZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wMmUyYmVmN2UyNTk4YzNlYTZhODRjZmRjNGFlYWJlYzZhNzlmNzBmYjZiNDQ5ZGRhYjRiMzFmOWJhZWFmY2NjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.Xrxw-T4edyPfJKpyA3bITyBLavHkDGXSmB-IR-xPphk)
![image](https://private-user-images.githubusercontent.com/176993881/393063902-eeb180f6-335c-46ea-8494-1d820a683c29.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MDUyNDYsIm5iZiI6MTczODkwNDk0NiwicGF0aCI6Ii8xNzY5OTM4ODEvMzkzMDYzOTAyLWVlYjE4MGY2LTMzNWMtNDZlYS04NDk0LTFkODIwYTY4M2MyOS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwN1QwNTA5MDZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04ODRmZTQ1YjI5MGY2ZWYxOGFmMzljMDQ2MTUwOWNlMDQwY2IzZjZjNzg3NDc2MWQwMzg4ODVhMGVmNWUwMzU1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.keWk_4o9ZEz0eTYgfCqEFc5VGTIk-aqoAwfEhspJY7A)
My goal is to test whether can load a namespace dynamically at client-side
Hence I make new json file
test.json
in each lang of locales, and extract key-valuedescription
fromfooter.json
intotest.json
I think that, in theory, in component Footer, i use
const { t } = useTranslation(['footer', 'test'])
, it should be able to load the new namespacetest
fine and the text of keydescription
should be displayed, isn't it?but result is that not able to display
the code i use is this
Could anyone explain for me why? and how to fix?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions