intlify / vue-i18n

Vue I18n for Vue 3

Home Page:https://vue-i18n.intlify.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linked messages cannot support non-nested syntax

fuping685 opened this issue · comments

Reporting a bug?

It works fine when I use nested syntax

const messages = {
  en: {
    message: {
      hello: 'Hello',
      hello_link: '@:message.hello'
    }
  }
}

<div>{{ $t('message.hello_link') }}</div> // Hello

It shows nothing when I use non-nested syntax

const messages = {
  en: {
    'message.hello': 'Hello',
    'message.hello_link': '@:message.hello'
  }
}

<div>{{ $t('message.hello_link') }}</div> // Nothing is shown

Expected behavior

It works normally in version 8.x

Reproduction

N/A

System Info

N/A

Screenshot

No response

Additional context

No response

Validations

Thank you for your reporting!

when you use the key of object path, you need to put flatJson: true to createI18n.
Then vue-i18n will flatten the message.

Thanks!