0
kansoftware created
Hi,
I want use localization for only language in both side client and server side, do not want to change date format and numeric / decimal format.
Could you please help for this.
Thanks Regards Mohit
3 Answer(s)
-
0
Hi @kansoftware
In that case, you can create a custom culture provider and specify date format and numeric format in this custom class.
You can create it like this;
public class MyRequestCultureProvider : RequestCultureProvider { public override Task DetermineProviderCultureResult(HttpContext httpContext) { var result = new ProviderCultureResult(culture: (StringSegment)"en-US", uiCulture: (StringSegment)"ar"); return Task.FromResult(result); } }
and use it like this;
app.UseAbpRequestLocalization(opts => { opts.RequestCultureProviders.Insert(0, new MyRequestCultureProvider()); });
-
0
I tried this code but now i am not able to change language. I just want to change language but do not want to change date format and numeric / decimal format.
-
0
Hi,
This was just a sample code. For a real example, you can take a look at https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.AspNetCore/AspNetCore/Localization/AbpUserRequestCultureProvider.cs and uiCulture or culture as you wish.