Skip to content

AvailableLocales option is not passed to global instance #1158

Open
@Angeart

Description

@Angeart

Reporting a bug?

AvailableLocales option (via createI18n) is not passed to the global instance without messages option.
but createI18n is accepted availableLocales option by type of VueI18nOptions.
Is it correct behavior?

Expected behavior

AvailableLocales option is passed to the global instance

Reproduction

Code

import { createI18n } from 'vue-i18n'

{
    const i18n = createI18n({
        legacy: false,
        locale: 'ja',
        messages: {
            en: { hoge: 'hoge' },
            ja: { hoge: 'ほげ' }
        }
    })

    console.log("with messages: " + i18n.global.availableLocales)
}
{
    const i18n = createI18n({
        legacy: false,
        locale: 'ja',
        availableLocales: ['en','ja']
    })

    console.log("without messages: " + i18n.global.availableLocales)
}

Result

"with messages: en,ja"
"without messages: ja"

Link

Runkit

System Info

System:
    OS: Linux 5.10 Ubuntu 22.04 LTS 22.04 LTS (Jammy Jellyfish)
    CPU: (8) x64 Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
    Memory: 11.62 GB / 15.60 GB
    Container: Yes
    Shell: 3.3.1 - /usr/bin/fish
  Binaries:
    Node: 16.17.0 - ~/n/bin/node
    Yarn: 1.22.19 - ~/n/bin/yarn
    npm: 8.15.0 - ~/n/bin/npm

Screenshot

No response

Additional context

I wanna use only <i18n></i18n> block without json or yaml language configs.
So I expect that behavior.

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions