Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix path issues in v1.9.1 #172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ return [
];
```

### Specifying the path to your language folder

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.

### Using [gulp](http://gulpjs.com/) (optional)

Install [`gulp-shell`](https://github.com/sun-zheng-an/gulp-shell) and then run it directly in your `gulpfile.js`:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,16 @@ public function register()

$files = $app['files'];

if ($laravelMajorVersion === 4) {
$langs = $app['path.base'].'/app/lang';
} elseif ($laravelMajorVersion >= 5) {
$langs = $app['path.base'].'/resources/lang';
$languagePath = $this->app['config']->get('localization-js')['lang_path'];
if (empty($languagePath)) {
if ($laravelMajorVersion === 4) {
$languagePath = '/app/lang';
} elseif ($laravelMajorVersion >= 5) {
$languagePath = '/resources/lang';
}
}
$langs = $app['path.base'].$languagePath;

$messages = $app['config']->get('localization-js.messages');
$generator = new Generators\LangJsGenerator($files, $langs, $messages);

Expand Down
5 changes: 5 additions & 0 deletions src/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@
* The default path to use for the generated javascript.
*/
'path' => public_path('messages.js'),

/*
* The path for your laravel lang folder
*/
'lang_path' => '',
];