Closed KhurshidYakubov closed 3 years ago
Hey, And which translations exist and which one is returned?
Firstly, creation order in store() function is like oz, uz, ru (en for future usage), as you can see below:
$data = [
'slug' => $get_slug_element,
'oz' => [
'title' => $request->oz_title,
],
'uz' => [
'title' => $request->uz_title,
],
'ru' => [
'title' => $request->ru_title,
],
'status' => $request->status,
'creator_id' => $user->id ?? 1,
];
$list_type = ListType::create($data);
Data was inserted only for 'uz' . But it is returning 'oz' (which means the first one from table).
And what's your app locale? app()->getLocale()
and/or in app.php
config.
In app.php
locale is oz. And app()->getLocale()
shows dependently what I choose. If I change the locale to uz title
appears. if I change to oz or ru it shows nothing because they are empty.
This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days
I have 4 locales. And I want to loop through my locales from top to bottom until one existing is found or end of list reached.
<p>{{ $list_type->translateOrDefault()->title}}</p>
In my opinion, I follwed all instructions which are mentioned in documentation. However, it is keeping to return only the first locale. How can I deal with this ?