Waavi / translation

Better translation management for Laravel
MIT License
360 stars 167 forks source link

How to create a language swticher? #123

Closed kadeeraziz closed 6 years ago

alexhouse commented 6 years ago

We constructed ours using a before middleware. Checked, in order, are a lang= query param, a session var, then finally a user's preference (stored in the DB). If any are set we check (via \Waavi\Translation\Repositories\LanguageRepository) that it's a valid locale before simply calling:

Lang::setLocale($locale);