Questions tagged [vue-i18n]

When mentioning the vue-i18n plugin in relation to Vue.js, this is what you need.

What is the best way to have Vue i18n fetch translations from a .json file during Unit Testing?

Previously, with vue-i18n (v8.25.0 and vue v2.6.14), I stored all translations in .ts files containing JS objects: import { LocaleMessages } from 'vue-i18n' const translations: LocaleMessages = { en: { test: 'Test', }, } export default translatio ...

Changing the URL within a Vue.js component without navigating away from the component

Just starting out with VueJs and working with wizaplace. I currently have a route set up as /breweries/:id, which uses the company's ID to fetch information from the wizaplace API. Within this data, there is a slug that I would like to display in the URL ...

Issue encountered during rendering: "TypeError: Attempting to access property '_t' of an undefined object" while running a Unit Test using Jest

I spent hours troubleshooting a unit test for my Vue.js component, but no matter how much I searched the internet, I kept encountering this error: console.error node_modules/vue/dist/vue.runtime.common.dev.js:1884 TypeError: Cannot read property ' ...

Retrieving the internationalization (i18n) locale language from the Pinia store

I am attempting to retrieve the value of the i18n locale language from my pinia store, however, an error is occurring Uncaught Error: [ ...

Utilizing Vue.js and i18n to fetch external JSON files from a server and seamlessly integrating them as globally accessible data in all components

I'm currently exploring ways to fetch translation files from a server and make them accessible across all components of the project. For instance, I can request to obtain this JSON: { "DASHBOARD_SETTINGS": "Einstellungen", &qu ...

What is the best way to integrate vue-i18n into my Vue router?

Here is a snippet from my main app.js: import Vue from 'vue' import language from './language' import VueI18n from 'vue-i18n' Vue.use(VueI18n) const i18n = new VueI18n({ locale: 'en', messages: language.messag ...

Guide to implementing vue i18n $t method in vuex getters for vue 3

How do I incorporate i18n $t into my getters to retrieve a static label? I attempted importing it in the following way: import { i18n } from '../../locales/i18n.js'; const getters = { guaranteePolicies: state => { let guaranteesS ...

What is the best way to translate my Vue components library for different languages?

Creating my own Vue components library has been rewarding, but I face the challenge of localizing a lot of text within these components. The usual translation tool, vue-i18n, requires being attached to Vue (e.g. Vue.use(VueI18n)), which can create conflict ...

What are the steps for integrating vue-i18n into a Vue web component?

As I work on developing a Vue web component with vue-cli 3 and the --target wc option, I have encountered an issue. The vue-i18n plugin that I need to use requires certain options to be passed to the main Vue instance as shown below: new Vue({ i18n: n ...

How can I retrieve the locale for dateTimeLocalization in Vue i18n?

Currently, I am using a tutorial on implementing i18n in my vue code. It is working well with just one inconvenience - the language is hard-coded. Here is how my Localization file looks: export default: { 'fr-fr': { ... }, &ap ...

"Utilize Vue i18n to properly display currency amounts in USD

Whenever I present my currency as USD, it always shows up like this: USD$500.00. I am attempting to eliminate the USD prefix from the beginning. Below is my numberFormats configuration: numberFormats: { 'en': { currency: { style: ...

Utilizing vue-i18n within Class-based Components in Vue 3

Currently, I am in the process of migrating from vue2 to vue3 and using the "Class Style Component". I have been utilizing vue-i18n. Will I be able to continue using vue-i18n with Vue3? Here is a snippet from my package.json: "dependencies": ...

Transforming Nested JavaScript Objects for Internationalization in Vue

In my VUE JS web application that utilizes i18n-vue, I am facing an issue with reformatting a JS Object to work with the i18n-vue setup. The translations are retrieved from the database and are structured in a certain way as shown below. I have tried seve ...

Leveraging an external global variable file that is not incorporated into the bundle

I have a JavaScript file dedicated to internationalization. I am looking for a way to provide this file to clients for them to edit without requiring me to rebuild the entire project. Currently, I store this file in the static folder so it is included in ...

Sorry, there was an error with Vue-i18n: Unable to access the 'config' property because it is undefined

Let's start by examining what functions correctly in App.js import router from './routes.js'; import VueI18n from 'vue-i18n'; const messages = { en: { message: { hello: 'hello world' } } } // Create VueI18n instance with options const ...

Discover the power of Vuetify's message translation in combination with Nuxt i18n

I am looking to implement translated error messages for Vuetify validation failures Template section <v-text-field v-model="message.name" outlined :label="$t('page.contact.form.name')" :rules=nameValidationRules > ...

Customize the formatting of linked locale messages in Vue's internationalization (i18n) feature using parameters

Is there a way to link locale messages in vue-i18n with a parameter? { "next": "Next step {step+1}: @:steps[{step}]", "steps": [ "Welcome", // 0 "Briefing", // 1 "Finish" // 2 ...

Warning in Vue 3 with ESLint: [intlify] HTML Detection Detected

Encountering a warning in the console stating "[intlify] Detected HTML in .....", yet unable to find a way to disable this specific warning for the mentioned line. Attempts were made to modify the eslintrc.js file to deactivate all v-html warnings, but unf ...

Localization translation in a user interface

I want to create a form with i18n translation. I've attempted it, but it's not functioning properly: <div id="form" align="center" justify="center"> <v-col sm="4" align="center" ...

Changing the locale in Vue I18n results in the disappearance of the component's content

Currently, I am in the process of integrating Vue I18n into my application. The issue I am facing is that when I switch the language using a locale switcher (without reloading the page), the translated strings appear correctly but the content above them di ...

Updating locale in Vue-i18n does not result in complete refresh of all components

Just diving into vue-i18n, it looks promising but facing some difficulties in getting it to function properly. Changing the locale updates all template translations correctly, however when script data() { return { locales: { en: this.$i18n.t ...

Addressing the reactivity issue when incorporating basic markdown directive into vuejs

In an effort to reduce dependency on vue-i18n formatting, I decided to create a simple Markdown formatter directive that only implements bold, emphasize, and strike-through styles. The current implementation of the directive is as follows: import _Vue ...