-
Hello everyone, So my question is: can Vue.js 2 syntax be used? Is it even supported? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I'd say give it a try and lmk if it doesn't work |
Beta Was this translation helpful? Give feedback.
-
As said here: #3289 (reply in thread) My solution (in Nuxt 2) is this: My export default {
plugins: [
{ src: "~/plugins/format.js" }
]
} My 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 => {
// Add the locale data for plurals and relative dates.
VueIntl.addLocaleData(require("vue-intl/locale-data/" + locale.slice(0, 2)));
// Register the messages for each locale.
Vue.registerMessages(locale, require("../locales/data/" + locale));
}); |
Beta Was this translation helpful? Give feedback.
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:My
plugins/format.js
file: