question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When switching languages, the data reactive is lost

See original GitHub issue

Reporting a bug?

“vue-i18n”: “9.2.0-beta.13” When switching languages, the data reactive is lost, 9.2.0-beta.11 version didn’t have this problem!

Expected behavior

I hope I don’t lose the responsiveness

Reproduction

import { createI18n } from ‘vue-i18n’;

import enDesign from ‘@jiaozhiye/qm-design/lib/locale/lang/en’; import zhDesign from ‘@jiaozhiye/qm-design/lib/locale/lang/zh-cn’;

import enLocale from ‘./lang/en’; import zhLocale from ‘./lang/zh-cn’;

const messages = { [enLocale.name]: { qm: enDesign.qm, app: enLocale.app, }, [zhLocale.name]: { qm: zhDesign.qm, app: zhLocale.app, }, };

const i18n = createI18n({ locale: ‘zh-cn’, fallbackLocale: ‘zh-cn’, messages, });

const { t, mergeLocaleMessage } = i18n.global;

const changeLocale = (lang: string): void => { i18n.global.locale = lang; };

export { t, mergeLocaleMessage, changeLocale }; export default i18n;

// ==============

By calling the changeLocale function to achieve language switch, unfortunately, it didn’t have the desired effect.

System Info

"vue": "^3.2.20",
"vue-i18n": "^9.2.0-beta.13",

Screenshot

No response

Additional context

No response

Validations

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
kazuponcommented, Oct 21, 2021

I’ve just released v9.2.0-beta.14 ! https://github.com/intlify/vue-i18n-next/releases/tag/v9.2.0-beta.14

Please check it! Thanks all!

1reaction
PeterAlfredLeecommented, Oct 21, 2021

@PeterAlfredLee you can try my repo here

https://github.com/zynth17/vitailse/tree/vue-i18n-bug

@zynth17 I just checked, it’s caused by #736. In short, when you use vue-i18n@9.2.0-beta.13, you will use vue-i18n.esm-browser.prod.js which has a tree-shaking issue.

vue-i18n-next has fixed # 736 in #754, but no new version has been released yet.

@kazupon I think we should release a new version from repo. WDYT?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multilingual in Reactive - Workaround to translate all page ...
When you click on a language, everything changes, except the headers of the table. I'm using the trigger event mechanism. Let me know...
Read more >
Reactive Programming - Part 1 - Techwondoe
According to Wikipedia: Reactive programming is a programming paradigm oriented around data flows and the propagation of change.
Read more >
Bilingual Language Switching: Production vs. Recognition
This study aims at assessing how bilinguals select words in the appropriate language in production and recognition while minimizing interference from the ...
Read more >
What about proactive language control? | SpringerLink
Put differently, reactive language control resolves any cross-language interference when it occurs, whereas proactive language control is a ...
Read more >
Proactive and Reactive Language Control in the Bilingual Brain
The data were then analyzed separately for each ROI using a 2 (cue type) × 2 (switch condition) × 3 (task phase) repeated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found