Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change default language in Middleware #912

Open
ducvu91 opened this issue Oct 29, 2024 · 0 comments
Open

How to change default language in Middleware #912

ducvu91 opened this issue Oct 29, 2024 · 0 comments

Comments

@ducvu91
Copy link

ducvu91 commented Oct 29, 2024

Hello,
I meet issue with default language. My site is multi tenant, each tenant has default language different. But now, i only set default language on provider, how i can set it in Middleware?.
My Case is:
my app have config default locale "en", with japan tenant, it default have ja, but when i set Config::set('app.locale', $lang); thì it not apply on Middleware. when i access domain/ja it still there, but when access domain/en it redirect to domain. it wrong beacause the lang default is ja, not en
but when i set in AppServiceProvider, it apply.
i don't know why, and i can't move logic detect tenant in to AppServiceProvider.
Pls help

==========================================
UPDATE:
i seen in code have function
public function getDefaultLocale()
{
return $this->defaultLocale;
}

$this->defaultLocale = $this->configRepository->get('app.locale');

can you add function setDefaultLocale() ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant