Add Russian to language switching
make this language main
need only 2 language RU/EN
Hi,
To add Russian (RU) as a language option to language switching in a Laravel application with flags, and set it as the main language alongside English (EN), you can follow these steps:
First, create language files for Russian (ru) and English (en) if they don't already exist in the resources/lang directory. You should have folders like en and ru containing language files such as messages.php. Ensure the language files have the required translations.
Open the config/app.php file and find the locale setting. Set it to 'ru' to make Russian the default language:
"locale" => "ru",
Route::get("lang/{locale}", "LocalizationController@index");
class LocalizationController extends Controller
{
public function index($locale)
{
if (in_array($locale, ["en", "ru"])) {
App::setLocale($locale);
session()->put("locale", $locale);
}
return redirect()->back();
}
}