
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
vue-i18n-composable
Advanced tools
Composition API for vue-i18n
in Vue 2.x
vue-i18n-composable@v1
: >=2.5 <=2.6
vue-i18n-composable@v2
: >=2.7 <3
npm i vue-i18n vue-i18n-composable
if you use Vue 2.5 - Vue 2.6, you need to install @vue/composition-api
npm i @vue/composition-api
// main.js
import Vue from 'vue'
import { createI18n } from 'vue-i18n-composable'
import App from './App.vue'
const i18n = createI18n({
locale: 'ja',
messages: {
en: {
language: 'English',
},
ja: {
language: '日本語',
},
},
})
const app = new Vue({
render: h => h(App),
i18n,
})
app.mount('#app')
In components:
<template>
<div>{{ t('language') }}</div>
</template>
<script>
import { defineComponent } from 'vue'
import { useI18n } from 'vue-i18n-composable'
export default defineComponent({
setup() {
return {
...useI18n()
}
}
})
</script>
// main.js
import Vue from 'vue'
import VueCompositionAPI, { createApp } from '@vue/composition-api'
import { createI18n } from 'vue-i18n-composable'
import App from './App.vue'
Vue.use(VueCompositionAPI)
const i18n = createI18n({
locale: 'ja',
messages: {
en: {
language: 'English',
},
ja: {
language: '日本語',
},
},
})
const app = createApp({
render: h => h(App),
i18n,
})
app.mount('#app')
In components:
<template>
<div>{{ t('language') }}</div>
</template>
<script>
import { defineComponent } from '@vue/composition-api'
import { useI18n } from 'vue-i18n-composable'
export default defineComponent({
setup() {
return {
...useI18n()
}
}
})
</script>
MIT License © 2020 Anthony Fu
FAQs
Composition API for vue-i18n in Vue 2.x
The npm package vue-i18n-composable receives a total of 1,821 weekly downloads. As such, vue-i18n-composable popularity was classified as popular.
We found that vue-i18n-composable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.