Base solution for your next web application
Open Closed

Arabic locale Issue #8277


User avatar
0
bosalah created

Switching to Arabic changes Dates to to Hijri format. I want them in Gregorian in fronend and backend V 8.0 ASP CORE with ANGULAR 8


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team
  • User Avatar
    0
    bosalah created

    I did your solution and it worked good but I can't change the language  in frontend I can't understand the last part about how can I  execute other request culture localizers in my custom class

    ----------------------------------------------------------- you need to execute other request culture localizers in your custom class

    1. First create a class like below in your *.Web.Host project:
    public class MyRequestCultureProvider : RequestCultureProvider
    {
    	public override Task<ProviderCultureResult> DetermineProviderCultureResult(HttpContext httpContext)
    	{
    		var result = new ProviderCultureResult(culture: (StringSegment)"en-US", uiCulture: (StringSegment)"ar");
    		return Task.FromResult(result);
    	}
    }
    

    <span class="colour" style="color: rgb(0, 0, 0);">Then, use it like this to see if server returns dates with correct format:</span>

    app.UseAbpRequestLocalization(opts =>
    {
    	opts.RequestCultureProviders.Insert(0, new MyRequestCultureProvider());
    });
    

    But, this will work before all request culture providers, so when you change the language on the UI, it will not work. So, you need to execute other request culture localizers in your custom class (like this one https://github.com/aspnetboilerplate/as ... rovider.cs), then determine correct uiCulture.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You just need to en-US when the current UI culture is "ar". otherwise you can return the current culture as is in your MyRequestCultureProvider class.

  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because of no recent activity. Please open a new issue if you are still having this problem.