-
-
Notifications
You must be signed in to change notification settings - Fork 380
Open
Labels
Status: Review NeededRequest for review commentsRequest for review comments
Description
Reporting a bug?
petite-vue-i18n cannot work with flatJson enabled, but when disabled, it works fine.
See #2010
TL;DR: petite-vue-i18n by default only works with a key:value (flat) json messages format, flatJson will recursively transforms a flat json key into a nested key, which will broke petite-vue-i18n when resolving messages, this is a problem of flatJson description rather than petite-vue-i18n's bug.
Expected behavior
.
Reproduction
import { createI18n } from 'petite-vue-i18n'
// Initialize i18n
const i18n = createI18n({
legacy: false,
flatJson: true,
locale: 'en',
fallbackLocale: 'en',
fallbackWarn: false,
missingWarn: false,
messages: {
en: { 'word.hello': 'Hello' },
},
})
const test = i18n.global.t('word.hello')
console.log({ test })Swapping to vue-i18n works fine.
System Info
.Screenshot
No response
Additional context
No response
Validations
- Read the Contributing Guidelines
- Read the Documentation
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussions
fgordillo
Metadata
Metadata
Assignees
Labels
Status: Review NeededRequest for review commentsRequest for review comments