I'm currently attempting to access my i18n-strings from a JSON file by following the instructions in this particular guide.
In my possession is a file named en-US.json
:
{
"world": "the world!"
}
To set up my Vue application, I am employing:
import { createI18n } from 'vue-i18n'
import enUS from '../src/i18n/en-US.json'
// Ensuring 'en-US' is defined as the leading structure for the resource
type MessageSchema = typeof enUS
const i18n = createI18n<[MessageSchema], 'en-US'>({
locale: 'en-US',
messages: {
'en-US': enUS
}
})
This method functions properly. However, upon introducing a non-ASCII character (e.g.
"world": "the w@rld!"
), an error message emerges:
[plugin:vite-plugin-vue-i18n] Cannot read properties of undefined (reading 'message')
/home/bernhard/wd/quasar2-project/src/i18n/en-US.json
Coincidentally, this issue does not arise when I directly include the same content in my .ts file:
const enUS = {
"world": "the w@rld!"
}
This suggests a potential problem with how the JSON data is being processed.