Closed saibotk closed 2 years ago
Hello!
This is not necessary as the publisher uses the lang_path
helper call by default.
This helper under the hood of Laravel works as follows: if the folder ./resources/lang
exists, then further work of the framework will be done with it, otherwise the default path will be taken - ./lang
https://github.com/laravel/framework/blob/9.x/src/Illuminate/Foundation/helpers.php#L507-L518 :
if (! function_exists('lang_path')) {
/**
* Get the path to the language folder.
*
* @param string $path
* @return string
*/
function lang_path($path = '')
{
return app()->langPath($path);
}
}
https://github.com/laravel/framework/blob/9.x/src/Illuminate/Foundation/Application.php#L323-L329 :
protected function bindPathsInContainer()
{
$this->instance('path', $this->path());
$this->instance('path.base', $this->basePath());
$this->instance('path.config', $this->configPath());
$this->instance('path.public', $this->publicPath());
$this->instance('path.storage', $this->storagePath());
$this->instance('path.database', $this->databasePath());
$this->instance('path.resources', $this->resourcePath());
$this->instance('path.bootstrap', $this->bootstrapPath());
$this->useLangPath(value(function () {
if (is_dir($directory = $this->resourcePath('lang'))) {
return $directory;
}
return $this->basePath('lang');
}));
}
So in order for the publisher to install files in the ./lang
folder, make sure the ./resources/lang
folder doesn't exist.
Thank you for your issue!
Uh well then it seems my test project might still had that folder, gonna check on that tomorrow.
Thank you very much for the elaborate and quick answer!
Wish you a nice weekend 👍
Thank you! You too!
It would be nice, if the publishing path could be adjusted / configured.
Use-case: Laravel 9 now defaults to "/lang" instead of "/resources/lang" and it would be nice to have the language files in one place. Otherwise i have to remove the "/lang" folder on a fresh install, because laravel will select "/resources/lang".
Thank you!