Questions tagged [vue-i18n]

Use when referencing the vue-i18n plugin for Vue.js

Internationalization plugin for Vue.js.

Github Documentation

567 questions
3
votes
3 answers

Vitest: $setup.t is not a function (Vite, Vue 3, TypeScript, vue-i18n)

I'm trying to unit test a simple component that uses translations with the vue-i18n module. Here are the files used: src/i18n/index.ts import { createI18n } from 'vue-i18n'; export function loadLanguages() { const context =…
AlbertGmzL
  • 31
  • 1
  • 3
3
votes
1 answer

vue18n with dynamic message key into the template

I'm using vue18n in my vue3 application. For a specific component I would like to provide my template with the translation key dynamically. So, I would like to use something like this:
Safari
  • 11,437
  • 24
  • 91
  • 191
3
votes
0 answers

Change nuxt-i18n locale with cookie on site load

I've two locale; "fa" and "en" with fa being default. I've tried to change it with the following code block both on nuxtServerInit and fetch hook of layout but it still revert back to my default locale and gives me json.parse error on route…
Mojtaba Barari
  • 1,127
  • 1
  • 15
  • 49
3
votes
1 answer

Trying to change change page title, using Quasar, meta and vue-i18n

I am using Quasar v2, using the Vue Composition API and vue-i18n, and I would like the site title to change display when the active language changes (via a drop down), but whatever I am trying does not result in the title language being changed. Any…
Andre M
  • 6,649
  • 7
  • 52
  • 93
3
votes
0 answers

Vue i18n sometimes warn about missing key

In my home component I have the following: const { location } = useLocation(); const { t, n } = useI18n(); const freeShippingValue = computed(() => { return n(100, 'currency', location.value); }); In my BaseMoney component I have: const { n } =…
HMR
  • 37,593
  • 24
  • 91
  • 160
3
votes
1 answer

How to persist localisation in a vue app?

I am trying to build a multilingual Vue app with vue-i18n, and I am wondering how to persist the selected language? Anybody has experience with localisation? Is it possible by adding the language as a param to vue router? And or are there other ways…
codeDragon
  • 35
  • 3
3
votes
1 answer

i18n : translate a sentence that one of words is bold

I want to translate this sentence in i18n Select branch(s) you want to send selected product after selecting Branch Click on submit As you can see , one word in above sentence is in tag. I have this solution , But I am not sure is this…
morteza mortezaie
  • 1,002
  • 14
  • 37
3
votes
2 answers

How to Translate Vue i18n of v-for data Array of String

I am new to vuejs and doing my project with multi language feature, German and English, but I have problem with data Array of String which is loops through of a lists, and I don't know how to translate it, here's what I meant export default { …
Killian Pierce
  • 121
  • 3
  • 12
3
votes
1 answer

vue-i18n: Wrong date format for e.g. Norwegian

I'm using vue-i18n (version 8.24.2) in my app, and everything works as expected except when rendering dates using locale = nb-NO (Norwegian). Expected format: dd.MM.yyyy. Actual format: MM/dd/yyyy. When switching locale to German, which is using the…
Roar S.
  • 8,103
  • 1
  • 15
  • 37
3
votes
1 answer

How to force translate i18n in some specific text (variable) in Vuejs

In normal context, we just attach translation property to a variable like : this.name = this.$t('language.name'); But I want to specific it in a specific language sometime( ex: in French). Can we do something like this in vue.js ? this.name =…
3
votes
1 answer

Vue3 - vue-cli-plugin-i18n - Can't change language dynamically

I am actually trying to follow this video tutorial : https://www.youtube.com/watch?v=CFGjn3yKMNc Summary of the problem : I can't change the language dynamically with i18n. It stays on the language i18n was initialised with. So, my i18n uses a…
grif
  • 31
  • 1
3
votes
3 answers

Vue i18n-$t undefined outside template

Hi so if I use {{$t('dash.port')}} inside of template the translation happens and everything works fine. Now I have an antdv table where i have columns declared this way : const columns = [ { title:"pone", dataIndex: 'pone', key:…
Cyrine
  • 87
  • 2
  • 9
3
votes
1 answer

Vue: vue-i18n: Cannot translate the value of keypath, Use the value of keypath as default

I am using Vue, and I want to show three languages. English, Tagalog and Cebuano. Now I have the error Cannot translate the value of keypath 'NavbarMobile.home'. Use the value of keypath as default. I checked if the plugin is working by…
Yohei Umezu
  • 421
  • 1
  • 6
  • 30
3
votes
2 answers

Nuxt.js - How do I use vue-i18n outside components?

I'm using the plugin vue-i18n for translations in a Nuxt.js-powered SPA. This allows easy access to messages within components, like this: $t('footer.press') But how do I get translations outside components? In my specific case, I need them in a…
gru
  • 2,319
  • 6
  • 24
  • 39
3
votes
2 answers

How to import i18n in Vue file

I am using i18n library in Vue.js for language translation. I want to to import in it my script and store a value in data, but I have trouble with importing it. How should I import it? I tried with import $t from "./i18n"; but that just returns this…
user14543107
  • 97
  • 1
  • 13