Skip to content

Commit f265633

Browse files
committed
docs: Improve Documentation
1 parent 811806c commit f265633

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
1-
# Laravel Vue i18n
1+
<h1 align="center" style="border:none !important">
2+
Laravel Vue i18n
3+
</h1>
24

3-
**laravel-vue-i18n** allows to connect your `Laravel` Framework translation files with `Vue`.
5+
<p align="center">
6+
<a href="https://github.com/xiCO2k/laravel-vue-i18n/actions"><img alt="GitHub Workflow Status (master)" src="https://img.shields.io/github/workflow/status/xiCO2k/laravel-vue-i18n/Tests/master"></a>
7+
<a href="https://www.npmjs.com/package/laravel-vue-i18n"><img alt="License" src="https://img.shields.io/npm/l/laravel-vue-i18n.svg?sanitize=true"></a>
8+
</p>
9+
10+
<p align="center">
11+
<b>laravel-vue-i18n</b> is a <b>Vue3</b> plugin that allows to connect your <b>Laravel</b> Framework <b>JSON</b> translation
12+
files with <b>Vue</b>. It uses the same logic used on <a href="https://laravel.com/docs/8.x/localization">Laravel Localization</a>.
13+
</p>
14+
15+
## Installation
16+
With [npm](https://www.npmjs.com):
17+
```sh
18+
$ npm i laravel-vue-i18n
19+
```
20+
21+
or with [yarn](https://yarnpkg.com):
22+
```sh
23+
$ yarn add laravel-vue-i18n
24+
```
425

526
## Usage
627

@@ -23,6 +44,9 @@ createApp()
2344

2445
### Plugin Options
2546

47+
- `lang` *(optional)*: if not provided it will try to find from the `<html lang="pt">` tag, if is not available it will default to `en`.
48+
- `resolve`: The way to reach your language files.
49+
2650
```js
2751
createApp().use(i18nVue, {
2852
lang: 'pt',
@@ -32,6 +56,8 @@ createApp().use(i18nVue, {
3256

3357
### trans()
3458

59+
The `trans()` method can be used on
60+
3561
```js
3662
// lang/pt.json
3763
{

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ export function trans(key: string, replacements?: ReplacementsInterface): string
8989
return message
9090
}
9191

92+
/**
93+
* The Vue Plugin. to be used on your Vue app like this: `app.use(i18nVue)`
94+
*/
9295
export const i18nVue: Plugin = {
9396
install: (app, currentOptions: OptionsInterface = {}) => {
9497
options = { ...options, ...currentOptions }

0 commit comments

Comments
 (0)