Unable to obtain the locales file content when using multiple files for same language in Vue 3 using vueI18n and intlify? #1682
Replies: 3 comments
-
@Aravinda93 Did you end up figuring this one out? Encountering the same issue, where my translations are managed by a 3rd party tool that I sync with, ending up with a layout like this: ├── en-GB
│ ├── collection.json
│ ├── dashboard.json
│ ├── helpmate.json
│ └── playground.json I could merge in all the JSONs, but I'd prefer if things were chunked by page and only loaded when necessary, which vite would be able to handle with |
Beta Was this translation helpful? Give feedback.
-
@Sensanaty If you figure out something please post the answer even I will implement it similarly. Even I will try to do and update you if I find out something. |
Beta Was this translation helpful? Give feedback.
-
Ok so I tried this and it worked for me:
i added 2 files in my locales
And i used it in
This worked for me. For your reference: CodeSandBox |
Beta Was this translation helpful? Give feedback.
-
How to use the variables/data from multiple locales files of the same languages such as
locales/en.json
andlocales/extended-en.json
. Currentlyen.json
works fine but unable to add fromextended-en.json
when using the@nuxtjs/i18n
module.I am trying to use locale files in my Nuxt 3-based application and everything works fine when I am using the single
en.json
file but if I try to add another file for the same language then the contents from that new file are not extracted only the main file works fine. I am using the@nuxtjs/i18n
andvueI18n
for internationalization.I have a
locales/en
folder which contains the locale filesen.json
anden-extended.jon
. I would like to obtain the content into my Nuxt 3 application but am unable to do so using the@nuxtjs/i18n
foren-extended.json
file content buten.json
file content works fine.Following is the config settings from
nuxt.config.js
:I tried adding additional parameters to it using the
en-extended
but its not working. I have placed the file and variables are present but still not working.Following is the way I am accessing the date:
I can see on my webpage that I am able to get:
"default.mainMessage"
but unable to get the"en-extended.default.extendedMessage"
It just displays the same variable nameen-extended.default.extendedMessage
rather than the actual value assigned inen-extended.yml
.I am still unable to make it work, any response would be really helpful on splitting the local files into multiple JSON file.
Beta Was this translation helpful? Give feedback.
All reactions