I'm using laravel 5.2 with locale. I have a function that reads all my language files and put them into an array:
$this->langPath = resource_path('lang/'.App::getLocale());
$allTranslations = collect(File::allFiles($this->langPath))->flatMap(function ($file) {
return [
($translation = $file->getBasename('.php')) => trans($translation),
];
});
This works fine. But the subfolder of my lang folder are missing of course. So I added another file read on the subfolder. But it returns only the name of the files and not the content:
$allModuleTranslations = collect(File::allFiles($this->langPath .'/modul'))->flatMap(function ($file) {
return [
($translation = $file->getBasename('.php')) => trans($translation),
];
});
This turns out only the name of the files i.e. general, module1 and not the content of these files. What I'm doing wrong here? This is the folder structure:
[lang]
[de]
someFile.php
anotherFile.php
[modul]
general.php
modul1.php
[en]
someFile.php
anotherFile.php
[modul]
general.php
modul1.php
Thanks in advance for any help!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire