Replies: 1 comment
-
Sorry, our poor documentation. Unfortunately, for type-safe resource with schema, which is supported in v9.2, only We'll update docs on these limitations. |
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
-
According to https://vue-i18n.intlify.dev/guide/advanced/sfc.html#json5 it should be possible to use json5 as format for the i18n files.
I use
In main.ts I do
import de from "./i18n/de.json"; import en from "./i18n/en.json";
I added the following section to my vue.config.js chainWebpack
config.module .rule('i18n') .test(/\.json$/) .exclude .clear() .end() .include .add(function() { return [ './src/i18n' ]; }) .end() .type("javascript/auto") .use('@intlify/vue-i18n-loader') .loader('@intlify/vue-i18n-loader');
In my de.json I added a test string
adminCaption : "Administration"
and it complains about wrong json syntax.
I also put the i18n in a file "de.json5", and adapted the above rule in vue.config.js accordingly, and typescript complained about
TS2307: Cannot find module './i18n/de.json5' or its corresponding type declarations.
In my tsconfig.json, the setting
"resolveJsonModule" : true,
is set.
For the future (once I have integrated the higher versions), I would like to use the feature https://vue-i18n.intlify.dev/guide/advanced/typescript.html#type-safe-resources-with-schema
Question: Is this kind of setup possible? Can one use json5 i18n files in a typescript project somehow? If yes, would the "type-safe-resources-with-schema"-thing still work?
Currently, I'm not sure wether the problem is my inability to configure it correctly, or some kind of missing feature support at tool side.
Thanks for any hints.
Beta Was this translation helpful? Give feedback.
All reactions