Skip to content
This repository was archived by the owner on Apr 22, 2024. It is now read-only.
This repository was archived by the owner on Apr 22, 2024. It is now read-only.

Undefined translation with default installation due to error in loadLocaleMessages function  #182

@yuchiko

Description

@yuchiko

Module versions

  • Vue CLI: @vue/cli 4.3.1
  • vue-cli-plugin-i18n: 2.0.1
  • vue version: 2.6.11

To Reproduce
Steps to reproduce the behavior:

  1. Create new vue application with vue-cli
  2. Add i18n with vue-cli command vue add i18n
  3. For all steps due the installation press Enter (en language)
  4. Try to use translation in any component by using $t('message')
  5. Note the issue that it shows a key only without translation

Expected behavior
It should show a translation from locales/en.json file

Additional context
I fixed this bug by removing .default in loadLocaleMessages function

So now I have:
messages[locale] = locales(key) instead of messages[locale] = locales(key).default

Because after testing I've assume that it returns undefined with .default

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