Package Exports
- laravel-vue-i18n
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (laravel-vue-i18n) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Laravel Vue i18n
laravel-vue-i18n allows to connect your Laravel
Framework translation files with Vue
.
Usage
import { createApp } from 'vue'
import { i18nVue } from 'laravel-vue-i18n'
createApp()
.use(i18nVue)
.mount(document.getElementById('app'));
<template>
<div>{{ $t('Hi all') }}</div>
</template>
Plugin Options
createApp().use(i18nVue, {
lang: 'pt',
resolve: lang => import(`../lang/${lang}.json`),
})
trans()
// lang/pt.json
{
"Welcome!": "Bem-vindo!",
"Welcome, :name!": "Bem-vindo, :name!",
}
import { trans } from 'laravel-vue-i18n';
trans('Welcome!'); // Bem-vindo!
trans('Welcome, :name!', { name: 'Francisco' }) // Bem-vindo Francisco!
trans('Welcome, :NAME!', { name: 'Francisco' }) // Bem-vindo FRANCISCO!