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

silentFallbackWarn not working properly #723

Closed
alexeigs opened this issue Oct 4, 2019 · 4 comments
Closed

silentFallbackWarn not working properly #723

alexeigs opened this issue Oct 4, 2019 · 4 comments

Comments

@alexeigs
Copy link

alexeigs commented Oct 4, 2019

Even after studying #593 , I still face the same issue despite the steps described there. Warnings are not silenced and I keep getting the following, when locale en is active. No issues when de is active.

[vue-i18n] Value of key 'Hi, nice to meet you' is not a string! 2 vue-i18n.esm.js:32
[vue-i18n] Cannot translate the value of keypath 'Hi, nice to meet you'. Use the value of keypath as default.

Setup:

const i18n = new VueI18n({
  locale: 'en',
  fallbackLocale: 'en',
  formatFallbackMessages: true,
  silentFallbackWarn: true,
  messages
})

en.ts

export default {
  Common: {
    about_us: 'About us',
  }
}

de.ts

export default {
  Common: {
    about_us: 'Über uns',
  },
  'Hi, nice to meet you': 'Hallo, schön dich kennenzulernen'
}

Using quasar, vue-loader 15.7.1.

@kazupon
Copy link
Owner

kazupon commented Oct 20, 2019

Thank you for your reporting!
Could you provide minimum reproduction codes, please?

@kazupon
Copy link
Owner

kazupon commented Jan 9, 2020

Closing due to inactivity.
Please open a new issue with a reference to this one if you can follow up with more information.

@kazupon kazupon closed this as completed Jan 9, 2020
@mohammadmojrian
Copy link

mohammadmojrian commented May 29, 2020

@kazupon I have the same issue

import VueI18n from "vue-i18n";
import Locale_en from "../lang/en.json";
import Locale_de from "../lang/de.json";

Vue.use(VueI18n);

const messages = {
    en: Locale_en,
    de: Locale_de
};

var locale = window.location.pathname.replace(/^\/([^\/]+).*/i, "$1");
const i18n = new VueI18n({
    locale: locale.trim().length && locale != "/" ? locale : 'en',
    fallbackLocale: "en",
    silentFallbackWarn: true,
    messages
});

@clamburger
Copy link

For future people who come across this issue, to silence the "Use the value of keypath as default" message, use silentTranslationWarn: true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants