Skip to content
This repository was archived by the owner on Jul 16, 2020. It is now read-only.

Commit 736df2c

Browse files
committed
Added config file to configure the source and output path.
1 parent 84fccb6 commit 736df2c

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

src/Commands/GenerateInclude.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ class GenerateInclude extends Command
2626
*/
2727
public function handle()
2828
{
29-
$root = base_path() . '/resources/lang';
29+
$root = base_path() . config('vue-i18n-generator.langPath');
3030

3131
$data = (new Generator)
3232
->generateFromPath($root);
3333

34-
$jsFile = base_path() . '/resources/assets/js/vue-i18n-locales.generated.js';
34+
$jsFile = base_path() . config('vue-i18n-generator.jsFile');
3535

3636
file_put_contents($jsFile, $data);
3737

src/GeneratorProvider.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ public function boot()
2525
$this->commands(
2626
'vue-i18n.generate'
2727
);
28+
29+
$this->publishes([
30+
__DIR__.'/config/vue-i18n-generator.php' => config_path('vue-i18n-generator.php'),
31+
]);
32+
2833
}
2934

3035
/**

src/config/vue-i18n-generator.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
return [
4+
/*
5+
|--------------------------------------------------------------------------
6+
| Laravel translations path
7+
|--------------------------------------------------------------------------
8+
|
9+
| The default path where the translations are stored by Laravel.
10+
| Note: the path will be prepended to point to the App directory.
11+
|
12+
*/
13+
14+
'langPath' => '/resources/lang',
15+
16+
17+
/*
18+
|--------------------------------------------------------------------------
19+
| Output file
20+
|--------------------------------------------------------------------------
21+
|
22+
| The javascript path where I will place the generated file.
23+
| Note: the path will be prepended to point to the App directory.
24+
|
25+
*/
26+
27+
'jsFile' => '/resources/assets/js/vue-i18n-locales.generated.js'
28+
];

0 commit comments

Comments
 (0)