Is there a way to pass a specific UI language to the registration page? This is coming from the website and I want it to be the defaut option.
-
MPA or SPA project? – aaron Apr 27 '18 at 01:38
-
The solution differs on Angular and MVC – Alper Ebicoglu Apr 27 '18 at 04:58
-
SPA, .net core + angular – Homam Apr 29 '18 at 10:59
2 Answers
If you look at the request headers sent by the browser, it includes "Accept-Language". It can look something like this:
en-US,en;q=0.9,es-419;q=0.8,es;q=0.7
Generally, the preference runs in descending order, so here, the browser is saying it prefers U.S. english before anything else. More here about what the q values mean: What is q=0.5 in Accept* HTTP headers?
You can access this value through in the controller.
Request.Headers["Accept-Language"]

- 865
- 1
- 9
- 14
you can send the culture with these headers
c=...
uic=...
and for MVC use culture parameter like below
/register?culture=tr
must be the first parameter of the query string
and last option; you can always override AbpUserRequestCultureProvider
UPDATE:
According to the implementation it accepts query string parameters as culture like below
?culture=es-MX&ui-culture=es-MX
See https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2103

- 8,884
- 1
- 49
- 55
-
For the asp.net core / Angular version, can I sent it in the query string insteadf of the header? scince it is coming from an external website – Homam Apr 29 '18 at 10:58
-
updated my answer.. you can send query string parameters see https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2103 – Alper Ebicoglu Apr 30 '18 at 07:16