Gathering detailed insights and metrics for @intlify/vue-i18n-extensions-nightly
Gathering detailed insights and metrics for @intlify/vue-i18n-extensions-nightly
Gathering detailed insights and metrics for @intlify/vue-i18n-extensions-nightly
Gathering detailed insights and metrics for @intlify/vue-i18n-extensions-nightly
vue-i18n extensions
npm install @intlify/vue-i18n-extensions-nightly
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (95.6%)
JavaScript (2.89%)
Shell (0.78%)
Vue (0.38%)
HTML (0.35%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
100 Stars
310 Commits
13 Forks
5 Watchers
18 Branches
14 Contributors
Updated on Jun 25, 2025
Latest Version
5.0.1-28621993.348528d
Package Id
@intlify/vue-i18n-extensions-nightly@5.0.1-28621993.348528d
Unpacked Size
33.50 kB
Size
8.50 kB
File Count
9
NPM Version
10.7.0
Node Version
18.20.3
Published on
Jun 02, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
29
Extensions for vue-i18n
This next
branch is development branch for Vue 3! The version for Vue 2 is now in master
branch!
This library exports the following extensions:
v-t
custom directive1$ npm i --save-dev @intlify/vue-i18n-extensions@next
v-t
custom directiveYou can use transform offered with this package, to support Server-side rendering for v-t
custom directives.
In order to use this feature, you need to specify to Vue compiler option.
The following example that use compile
of @vue/compiler-ssr
:
1import * as runtimeDom from '@vue/runtime-dom' 2import { compile } from '@vue/compiler-ssr' 3import { defineComponent, createSSRApp } from 'vue' 4import { renderToString } from '@vue/server-renderer' 5import { createI18n, useI18n } from 'vue-i18n' 6import { transformVTDirective } from '@intlify/vue-i18n-extensions' 7 8// create i18n instance 9const i18n = createI18n({ 10 locale: 'ja', 11 messages: {} 12}) 13 14// get transform from `transformVTDirective` function 15const transformVT = transformVTDirective() 16 17// compile your source 18const source = `<div v-t="{ path: 'dessert', locale: 'en', plural: 2, args: { name: 'banana' } }"/>` 19const { code } = compile(source, { 20 mode: 'function', 21 directiveTransforms: { t: transformVT } // <- you need to specify to `directiveTransforms` option! 22}) 23 24// render functionalization 25const render = Function('require', 'Vue', code)(require, runtimeDom) 26 27// e.g. set render function to App component 28const App = defineComponent({ 29 setup() { 30 return useI18n({ 31 locale: 'en', 32 inheritLocale: false, 33 messages: { 34 en: { 35 apple: 'no apples | one apple | {count} apples', 36 banana: 'no bananas | {n} banana | {n} bananas', 37 dessert: 'I eat @:{name}!' 38 } 39 } 40 }) 41 }, 42 ssrRender: render 43}) 44 45// create SSR app 46const app = createSSRApp(App) 47 48// install vue-i18n 49app.use(i18n) 50 51console.log(await renderToString(app)) 52// output -> <div>I eat 2 bananas!</div>`
v-t
custom directiveYou can pre-translation i18n locale messages of vue-i18n.
:warning: NOTE: Only the scope of global i18n locale messages can be pre-translated !!
:warning: NOTE: Currently only
v-t
custom directive is supported !!
In order to use this feature, you need to specify to Vue compiler option.
The following example that use compile
of @vue/compiler-dom
:
1import { compile } from '@vue/compiler-dom' 2import { createI18n } from 'vue-i18n' 3import { transformVTDirective } from '@intlify/vue-i18n-extensions' 4 5// create i18n instance 6const i18n = createI18n({ 7 locale: 'ja', 8 messages: { 9 en: { 10 hello: 'hello' 11 }, 12 ja: { 13 hello: 'こんにちは' 14 } 15 } 16}) 17 18// get transform from `transformVTDirective` function, with `i18n` option 19const transformVT = transformVTDirective({ i18n }) 20 21const { code } = compile(`<p v-t="'hello'"></p>`, { 22 mode: 'function', 23 hoistStatic: true, 24 prefixIdentifiers: true, 25 directiveTransforms: { t: transformVT } // <- you need to specify to `directiveTransforms` option! 26}) 27console.log(code) 28/* 29 output -> 30 const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = Vue 31 32 return function render(_ctx, _cache) { 33 return (_openBlock(), _createBlock(\\"div\\", null, \\"こんにちは!\\")) 34 } 35*/
The following configuration example of vue-loader
:
1const { VueLoaderPlugin } = require('vue-loader') 2const { createI18n } = require('vue-i18n') 3const { transformVTDirective } = require('@intlify/vue-i18n-extensions') 4 5const i18n = createI18n({ 6 locale: 'ja', 7 messages: { 8 en: { 9 hello: 'hello' 10 }, 11 ja: { 12 hello: 'こんにちは' 13 } 14 } 15}) 16const transformVT = transformVTDirective(i18n) 17 18module.exports = { 19 module: { 20 // ... 21 rules: [ 22 { 23 test: /\.vue$/, 24 use: [ 25 { 26 loader: 'vue-loader', 27 options: { 28 compilerOptions: { 29 directiveTransforms: { t: transformVT } 30 } 31 } 32 } 33 ] 34 } 35 // ... 36 ] 37 }, 38 plugins: [new VueLoaderPlugin()], 39 parallel: false // the compilerOptions.directiveTransforms are not serializable 40}
You can specify the transform resulting from transformVTDirective
in the compiler options for each package offered by vue-next, and tool chains:
@vue/compiler-core
(options
at baseCompile
function)@vue/compiler-dom
(options
at compile
function)@vue/compiler-ssr
(options
at compile
function)@vue/compiler-sfc
(compilerOptions
at compileTemplate
function)vue-loader
(compilerOptions
at options
)rollup-plugin-vue
(compilerOptions
at Options
)vite
(vueCompilerOptions
at CoreOptions
)About details, See docs
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Reason
dependency not pinned by hash detected -- score normalized to 1
Details
Reason
Found 2/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
21 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More