Skip to content

Commit 7bb3226

Browse files
authored
Merge pull request #33 from ludo237/patch-1
Update README.md
2 parents 1de1b34 + 4a51590 commit 7bb3226

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,20 @@ Vue.prototype.trans = new Lang( { messages, locale: default_locale, fallback: fa
117117
:placeholder="trans.get('search.placeholder')"></b-input>
118118
```
119119

120+
## A note about json files
121+
122+
Laravel 5.4+ allows localization to be strutured [using a single `.json` file for each language](https://laravel.com/docs/5.7/localization#using-translation-strings-as-keys), in order to use the strings inside the provided json file you must prepend the `__JSON__` key
123+
124+
```
125+
// Assuming that es.json exists and it is the default locale in your app
126+
{
127+
"I love programming": "Me encanta programar"
128+
}
129+
130+
// Example.vue
131+
<b-input v-model="query" type="text" :placeholder="trans.get('__JSON__.I love programming')"></b-input>
132+
```
133+
120134
## Routing
121135

122136
This package exposes one route `http://localhost/js/lang.js` by default but you can change the prefix to anything you whish in config file.

0 commit comments

Comments
 (0)