Skip to content

Commit e52ae63

Browse files
committed
todo
1 parent aa4e6bc commit e52ae63

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/Manager.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function missingKey($namespace, $group, $key)
4242
public function importTranslations($replace = false)
4343
{
4444
$counter = 0;
45+
$theme = config('themes.default', 'default');
4546

4647
foreach ($this->files->directories($this->app['path.lang']) as $langPath) {
4748
$locale = basename($langPath);
@@ -51,6 +52,9 @@ public function importTranslations($replace = false)
5152
if (in_array($group, $this->config['exclude_groups'])) {
5253
continue;
5354
}
55+
if (in_array($group, ['vendor', 'themes'])) {
56+
continue;
57+
}
5458
$subLangPath = str_replace($langPath . DIRECTORY_SEPARATOR, "", $info['dirname']);
5559
if ($subLangPath != $langPath) {
5660
$group = $subLangPath . "/" . $group;
@@ -65,6 +69,37 @@ public function importTranslations($replace = false)
6569
}
6670
}
6771

72+
73+
foreach ($this->files->directories($this->app['path.lang']) as $langPath) {
74+
$locale = basename($langPath);
75+
foreach ($this->files->allfiles($langPath) as $file) {
76+
$info = pathinfo($file);
77+
$group = $info['filename'];
78+
if (in_array($group, $this->config['exclude_groups'])) {
79+
continue;
80+
}
81+
if (in_array($group, ['vendor', 'themes'])) {
82+
continue;
83+
}
84+
$subLangPath = str_replace($langPath . DIRECTORY_SEPARATOR, "", $info['dirname']);
85+
if ($subLangPath != $langPath) {
86+
$group = $subLangPath . "/" . $group;
87+
}
88+
//todo
89+
$translations = \Lang::getLoader()->load($locale, $group, $theme);
90+
if ($translations && is_array($translations)) {
91+
foreach (array_dot($translations) as $key => $value) {
92+
$importedTranslation = $this->importTranslation($key, $value, $locale, $group, $replace);
93+
$counter += $importedTranslation ? 1 : 0;
94+
}
95+
}
96+
}
97+
}
98+
99+
100+
101+
102+
68103
foreach ($this->files->files($this->app['path.lang']) as $jsonTranslationFile) {
69104
if (strpos($jsonTranslationFile, '.json') === false) {
70105
continue;

0 commit comments

Comments
 (0)