I have upgraded my Laravel 8 application to version 9, and according to the docs: upgrade guide, the resources/lang
directory is now located in the root project directory (lang
).
I've moved the lang
directory to the root directory of my project, but it does not seem to work.
// config/app.php
'locale' => 'pt-BR',
and
// lang/pt-BR/messages.php
return [
'welcome' => 'Welcome to the app!',
];
Controller
return response()->json([
'message' => Lang::get('messages.welcome') // it returns "messages.welcome"
]);
But when I change the lang
directory back to /resources/lang
, it works fine like in previous laravel versions. So I created a new fresh project of Laravel 9, and it worked, which leads me to think that some additional configuration is needed, but it's not documented in the upgrade guide. My composer.json
dependencies are precisely the same as the new laravel project. Is there any additional configuration that needs to be done for Laravel to recognize the directory?