Skip to content

Commit aeac5a3

Browse files
committed
feat: First Commit
0 parents  commit aeac5a3

18 files changed

+14449
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/node_modules
2+
/coverage
3+
/dist
4+
npm-debug.log*

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"printWidth": 120,
5+
"trailingComma": "none"
6+
}

LICENSE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) Francisco Madeira [email protected]
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Laravel Vue i18n
2+
3+
**laravel-vue-i18n** allows to connect your `Laravel` Framework localization files with `Vue`.
4+
5+
## Usage
6+
7+
```js
8+
import { createApp } from 'vue'
9+
import { i18nVue } from 'laravel-vue-i18n'
10+
11+
createApp()
12+
.use(i18nVue)
13+
.mount(document.getElementById('app'));
14+
```
15+
16+
```html
17+
<template>
18+
<div>{{ $t('Hi all') }}</div>
19+
</template>
20+
```
21+
22+
### Plugin Options
23+
24+
```js
25+
createApp().use(i18nVue, {
26+
lang: 'pt',
27+
resolve: lang => import(`../lang/${lang}.json`),
28+
})
29+
```
30+
31+
### trans()
32+
33+
```js
34+
// lang/pt.json
35+
{
36+
"Welcome!": "Bem-vindo!",
37+
"Welcome, :name!": "Bem-vindo, :name!",
38+
}
39+
40+
import { trans } from 'laravel-vue-i18n';
41+
42+
trans('Welcome!'); // Bem-vindo!
43+
trans('Welcome, :name!', { name: 'Francisco' }) // Bem-vindo Francisco!
44+
trans('Welcome, :NAME!', { name: 'Francisco' }) // Bem-vindo FRANCISCO!
45+
```
46+
47+

babel.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
plugins: ['@vue/babel-plugin-jsx'],
3+
presets: [
4+
['@babel/preset-env',
5+
{
6+
targets: {
7+
node: 'current'
8+
}
9+
}
10+
]
11+
]
12+
}

jest.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const path = require('path')
2+
3+
module.exports = {
4+
preset: 'ts-jest',
5+
globals: {
6+
'ts-jest': {
7+
babelConfig: true
8+
}
9+
},
10+
testEnvironment: 'jsdom',
11+
transform: {
12+
'^.+\\js$': 'babel-jest'
13+
},
14+
moduleFileExtensions: ['vue', 'js', 'json', 'jsx', 'ts', 'tsx', 'node']
15+
}

0 commit comments

Comments
 (0)