0

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.

underscore_d
  • 6,309
  • 3
  • 38
  • 64
Homam
  • 23,263
  • 32
  • 111
  • 187

2 Answers2

1

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"]
Jason Roner
  • 865
  • 1
  • 9
  • 14
1

you can send the culture with these headers

c=...
uic=...

https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.AspNetCore/AspNetCore/Localization/AbpLocalizationHeaderRequestCultureProvider.cs#L12

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

https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.AspNetCore/AspNetCore/Localization/AbpUserRequestCultureProvider.cs

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

Alper Ebicoglu
  • 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