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

Dynamic language loading with flatJson does not work for deeply linked messages #1595

Closed
4 tasks done
joukokar opened this issue Oct 19, 2023 · 0 comments · Fixed by #1601
Closed
4 tasks done

Dynamic language loading with flatJson does not work for deeply linked messages #1595

joukokar opened this issue Oct 19, 2023 · 0 comments · Fixed by #1601
Labels
good first issue Good for newcomers 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage Status: PR Welcome Welcome to Pull Request Status: Review Needed Request for review comments Type: Bug Bug or Bug fixes

Comments

@joukokar
Copy link

joukokar commented Oct 19, 2023

Reporting a bug?

When using lazy language loading with flatJson: true, and setting messages with

i18n.global.setLocaleMessage('locale', { "simple": "simple", "nested.key": "nested", "content": "@:simple @:nested.key" })

only the top level linked messages are working correctly.

$t("content")

results in

simple

Expected behavior

Nested objects also can be referred in linked message.

$t("content")

should become

simple nested

Reproduction

Following the lazy loading guide, but having flatJson: true the "@:nested.key" links stop working while "@:simple" works.

https://stackblitz.com/edit/vitejs-vite-wymdb6?file=src%2Fmain.ts

System Info

Binaries:
    Node: 18.17.1 - ~/.nodenv/versions/18.17.1/bin/node
    npm: 9.6.7 - ~/.nodenv/versions/18.17.1/bin/npm
    pnpm: 8.9.2 - ~/.nodenv/versions/18.17.1/bin/pnpm
  npmPackages:
    @intlify/core-base: workspace:* => 9.5.0 
    @intlify/message-compiler: workspace:* => 9.5.0 
    vitepress: 1.0.0-rc.22 => 1.0.0-rc.20 
    vitest: ^0.34.3 => 0.34.3 
    vue: 3.3.4 => 3.3.4 
    vue-i18n: workspace:* => 9.5.0

Screenshot

No response

Additional context

Possibly bit related PR: #1549

As a workaround, I am converting flat JSON manually into nested one before calling setLocaleMessage but it would be best to reuse the exactly same conversion logic as in vue-i18n.

Validations

@joukokar joukokar added the Status: Review Needed Request for review comments label Oct 19, 2023
@kazupon kazupon added Type: Bug Bug or Bug fixes good first issue Good for newcomers Status: PR Welcome Welcome to Pull Request 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage labels Oct 22, 2023 — with Volta.net
kazupon added a commit that referenced this issue Oct 22, 2023
kazupon added a commit that referenced this issue Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage Status: PR Welcome Welcome to Pull Request Status: Review Needed Request for review comments Type: Bug Bug or Bug fixes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants