Skip to content

Commit c675f0c

Browse files
committed
update
1 parent c819424 commit c675f0c

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ return [
9393
];
9494
```
9595

96+
### Specifying the path to your language folder
97+
98+
Out of the box, this package points to `/app/lang` in Laravel 4 or the `resources/lang` in Laravel >= 5 but you can specify where yours exists by editing the `lang_path` key in the config file.
99+
96100
### Using [gulp](http://gulpjs.com/) (optional)
97101

98102
Install [`gulp-shell`](https://github.com/sun-zheng-an/gulp-shell) and then run it directly in your `gulpfile.js`:

src/Mariuzzo/LaravelJsLocalization/LaravelJsLocalizationServiceProvider.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,16 @@ public function register()
7070

7171
$files = $app['files'];
7272

73-
if ($laravelMajorVersion === 4) {
74-
$langs = $app['path.base'].'/app/lang';
75-
} elseif ($laravelMajorVersion >= 5) {
76-
$langs = $app['path.base'].'/resources/lang';
73+
$languagePath = $this->app['config']->get('localization-js')['lang_path'];
74+
if (empty($languagePath)) {
75+
if ($laravelMajorVersion === 4) {
76+
$languagePath = '/app/lang';
77+
} elseif ($laravelMajorVersion >= 5) {
78+
$languagePath = '/resources/lang';
79+
}
7780
}
81+
$langs = $app['path.base'].$languagePath;
82+
7883
$messages = $app['config']->get('localization-js.messages');
7984
$generator = new Generators\LangJsGenerator($files, $langs, $messages);
8085

src/config/config.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,9 @@
1919
* The default path to use for the generated javascript.
2020
*/
2121
'path' => public_path('messages.js'),
22+
23+
/*
24+
* The path for your laravel lang folder
25+
*/
26+
'lang_path' => '',
2227
];

0 commit comments

Comments
 (0)