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

Commit 9079c9b

Browse files
authored
Merge pull request #9 from appointer/support-dir-nesting
Support dir nesting (and further minor tweaks)
2 parents baa633c + e674e5a commit 9079c9b

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
],
1313
"require": {
1414
"php": ">=5.5.0",
15-
"laravel/framework": "~5.1"
15+
"illuminate/console": "~5.1.0|~5.2.0|~5.3.0",
16+
"illuminate/support": "~5.1.0|~5.2.0|~5.3.0"
1617
},
1718
"require-dev": {
1819
"phpunit/phpunit": "~4.7"

src/Generator.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,21 @@ private function allocateLocaleArray($path)
4242

4343
$dir = new DirectoryIterator($path);
4444
foreach ($dir as $fileinfo) {
45-
if (!$fileinfo->isDot()) {
45+
// Do not mess with dotfiles at all.
46+
if ($fileinfo->isDot()) {
47+
continue;
48+
}
49+
50+
// Check if the "file" is a subdirectory which has to be scanned.
51+
if ($fileinfo->isDir()) {
52+
// Recursivley iterate through subdirs, until everything was allocated.
53+
$data[$fileinfo->getFilename()] =
54+
$this->allocateLocaleArray($path . '/' . $fileinfo->getFilename());
55+
} else {
4656
$noExt = $this->removeExtension($fileinfo->getFilename());
57+
4758
// Ignore non *.php files (ex.: .gitignore, vim swap files etc.)
48-
if (pathinfo($fileinfo->getFileName())['extension'] !== 'php') {
59+
if (pathinfo($fileinfo->getFileName(), PATHINFO_EXTENSION) !== 'php') {
4960
continue;
5061
}
5162
$tmp = include($path . '/' . $fileinfo->getFilename());

src/GeneratorProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ public function boot()
3030
__DIR__.'/config/vue-i18n-generator.php' => config_path('vue-i18n-generator.php'),
3131
]);
3232

33+
$this->mergeConfigFrom(
34+
__DIR__.'/config/vue-i18n-generator.php',
35+
'vue-i18n-generator'
36+
);
3337
}
3438

3539
/**

0 commit comments

Comments
 (0)