Skip to content

can't get defined objects or array used vue-in18next grammar in composition mode  #380

@calvinxie668

Description

@calvinxie668

vue & vue-i18n version

ex:

  • vue: 3.0.0
  • vue-i18n: 9.0.0-rc.8

Reproduction Link

Steps to reproduce

use t('arr') in composition mode, it can't get the object or array

What is Expected?

Can get defined objects or array just like vue-i18n used in vue 2.x

const arr = [1, 2, 3]
this.$t('arr')  // [1, 2, 3]

What is actually happening?

import { useI18n } from 'vue-i18n'
onMounted(async() => {
            console.log(t('hqIndex')) 
      
        })
        const { t } = useI18n({
            messages: MESSAGES
        })
        return {
            ...toRefs(state),
            btnName,
            t
       }

shared.esm-bundler.js?f83d:54 [intlify] Not found 'hqIndex' key in 'cn' locale messages
but i defined a object examples are as follows:

{
  en: {
      hqIndex: [
        { name: 'aa', id: 1 }
     ] 
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions