Skip to content

[vue-intl] Is there a Vue.js 2 syntax? #3289

Answered by 0xMANFRE
0xMANFRE asked this question in Q&A
Discussion options

You must be logged in to vote

As said here: #3289 (reply in thread) vue-intl does no longer support Vue 2/Nuxt 2, but an older version (vue-intl@3.1.0) still support it.

My solution (in Nuxt 2) is this:
npm i vue-intl@3.1.0

My nuxt-config.js file:

export default {
  plugins: [
    { src: "~/plugins/format.js" }
  ]
}

My plugins/format.js file:

import Vue from "vue";
import VueIntl from "vue-intl";

// Install the vue-intl plugin and register the custom formats.
VueIntl.install(Vue, {
    defaultFormats: require("../locales/customFormats")
});

// Set the default language.
Vue.setLocale("en-GB");

// Set the project languages.
const locales = ["de-DE", "en-GB", "es-ES", "fr-FR", "it-IT"];

locales.forEach(locale => {
    

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@0xMANFRE
Comment options

@longlho
Comment options

@0xMANFRE
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by 0xMANFRE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants