Skip to content

Commit 47481c0

Browse files
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # src/Classes/ExportLocalizations.php
2 parents 3610fd9 + 7bb3226 commit 47481c0

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

README.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ First example would be to add view composed variable and use it in blade views.
6161
use ExportLocalization;
6262
6363
// Without alias
64-
use KgBot\LaravelLocalization\Facades\ExportLocalizations as LaravelLocalization;
64+
use KgBot\LaravelLocalization\Facades\ExportLocalizations as ExportLocalization;
6565
6666
6767
View::composer( 'view.file', function ( $view ) {
@@ -125,6 +125,20 @@ Vue.prototype.trans = new Lang( { messages, locale: default_locale, fallback: fa
125125
:placeholder="trans.get('search.placeholder')"></b-input>
126126
```
127127

128+
## A note about json files
129+
130+
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
131+
132+
```
133+
// Assuming that es.json exists and it is the default locale in your app
134+
{
135+
"I love programming": "Me encanta programar"
136+
}
137+
138+
// Example.vue
139+
<b-input v-model="query" type="text" :placeholder="trans.get('__JSON__.I love programming')"></b-input>
140+
```
141+
128142
## Routing
129143

130144
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)