Welcome Guest, Not a member yet? Register   Sign In
Subdomains based localization
#2

The simplest way to define language locale is to set it in BaseController:

Code:
$domain = $_SERVER['HTTP_HOST'];
$domain_paths = explode('.', $domain);

if (count($domain_paths) == 3)
    $locale = $domain_paths[0];
else
    $locale = $request->config->defaultLocale;

$request->setLocale($locale);

It's working. But there must be more than one action "set locale". For example, "get all locales", "get locale from cookie", etc.
So we need some Class.
Questions:
1) What is the best way to implement this: library, model or other? What do you advise?
2) Where the best to set locale? I think not Routes.php, and not App.php (maybe?).
Reply


Messages In This Thread
Subdomains based localization - by ARAmiss - 12-11-2019, 09:52 AM
RE: Subdomains based localization - by ARAmiss - 12-12-2019, 02:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB