I have below code in my controller.
public function AllCountries() {
$Countries = (new \App\DataAccess\CountryData())->GetAllCountries();
app()->setLocale('fr');
return view('Country.List')->with('Countries', $Countries->getData()->CountryList);
}
Definition of method to fetch data is below.
public function GetAllCountries() {
return response()->json(['CountryList' => \App\Models\CountryModel::all()]);
}
Below is the screenshot which shows Translation array
Below is the screenshot that shows the View called by Controller has just one word to show translation only.
When I run the application, I get following error.
Use of undefined constant CountriesList - assumed 'CountriesList' (View: C:\xampp\htdocs\MyAccountesources\views\Country\List.blade.php)
Normally when we see websites which is not a default language set in our browser. We see a notification to translate the page on Page load. See the screenshot below.
But this does not come on my side. Although I can see French language but Translation notification is not coming. Why?