Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composition API: Message links to global-scoped messages inside local-scoped messages are not resolved #933

Closed
5 tasks done
M3psipax opened this issue Feb 21, 2022 · 0 comments · Fixed by #945
Closed
5 tasks done
Labels
Status: PR Welcome Welcome to Pull Request Type: Bug Bug or Bug fixes

Comments

@M3psipax
Copy link

Reporting a bug?

I'm using Composition API. I have some global i18n messages as well as some messages that are specific to a component (SFC).

I'm preparing i18n in every component like this:

//myLocalSFC.vue
import { useI18n } from "vue-i18n";
import messages from "./myLocalSFC.i18n.json";

const { t } = useI18n({ messages });

When calling the translation function t, I can successfully retrieve messages from global scope as long as they're not contained inside my local i18n messages.

However, if my local messages contain links to global messages like

//myLocalSFC.i18n.json
{
    "en": {
        "helloWorld": "Message from global @:myGlobalKey.myGlobalMessage"
    }
}

the global link cannot be resolved and comes up empty.

Expected behavior

If global fallback exists by default in any capacity, I would also expect global resolution of linked messages to work.

Reproduction

trivial

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (4) x64 Intel(R) Core(TM) i5-4460  CPU @ 3.20GHz
    Memory: 7.37 GB / 15.71 GB
  Binaries:
    Node: 14.17.1 - D:\Programme\nodejs\node.EXE
    npm: 8.5.1 - D:\Programme\nodejs\npm.CMD
  Browsers:
    Chrome: 98.0.4758.102
    Edge: Spartan (44.19041.1266.0), Chromium (98.0.1108.56)
    Internet Explorer: 11.0.19041.1202
  npmPackages:
    @vue/cli-plugin-eslint: ~4.5.0 => 4.5.15
    @vue/cli-plugin-router: ~4.5.0 => 4.5.15
    @vue/cli-plugin-typescript: ~4.5.0 => 4.5.15
    @vue/cli-plugin-unit-mocha: ~4.5.0 => 4.5.15
    @vue/cli-service: ~4.5.0 => 4.5.15
    @vue/compiler-sfc: ^3.0.0 => 3.2.26
    @vue/eslint-config-prettier: ^6.0.0 => 6.0.0
    @vue/eslint-config-typescript: ^7.0.0 => 7.0.0
    @vue/test-utils: ^2.0.0-0 => 2.0.0-rc.18
    vue: ^3.0.0 => 3.2.26
    vue-i18n: ^9.2.0-beta.26 => 9.2.0-beta.26
    vue-router: ^4.0.0-0 => 4.0.12

Screenshot

No response

Additional context

No response

Validations

@M3psipax M3psipax added the Status: Review Needed Request for review comments label Feb 21, 2022
@kazupon kazupon added Status: In Progress Work in Progress Status: PR Welcome Welcome to Pull Request Type: Bug Bug or Bug fixes and removed Status: Review Needed Request for review comments Status: In Progress Work in Progress labels Mar 1, 2022
kazupon added a commit that referenced this issue Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: PR Welcome Welcome to Pull Request Type: Bug Bug or Bug fixes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants