5 years ago

Where to setLocale in laravel 5 on multilingual - multidomain app

Posted 5 years ago by zoransa


Lets say I have

example.com en

ezample.de de

example.co.il he

ezamplearabic.com ar

so you get idea ~15 domains and one website. There are two approaches for products they all have the same 'id' across domains so there is product and product_lang table that contains translations of language specific stuff and en_articles, de_articles, he_articles tables for Articles Eloquent model that is select based on domain we access. Just to note there is one document root for all domains and just based on domain name laravel should set locale and users cannot choose different language on the same domain they can only switch domains to switch language.

The question is where to put this localization that will boot early in app and set up everything even before midlware etc.

Please sign in or create an account to participate in this conversation.