Hi
Switching to Arabic changes Dates to to Hijri format. I want them in Gregorian. Also numbers appear in Hindu and I want them in a different locale.
Can I switch to Arabic translation while keeping Dates, Numbers and Currency in English or some other locale ?
Thanks
UPDATE: I think I've managed this by changing locale of Angular and MomentJs. For Angular I added mappings between Arabic and the targeted locale through LocaleMapping. And the same I'm going to do with moment locale
Hi @ismcagdas
Angular I just added the following mapping in AppConfig:
{
"from": "ar",
"to": "en"
}
Moment I added a helper method that takes care of mapping Moment locale in AppPreBootstrap. In my case ar-kw was fine:
public static mapCultureForMoment(currentCulture: string): string {
const cultureMap = {
'ar': 'ar-kw'
};
if (cultureMap[currentCulture]) {
return cultureMap[currentCulture];
}
return currentCulture;
}
I still have something to update to reflect this on Date format Pipe
After solving the frontend part, I noticed that Hijri date is still resolved from BE, and nothing to do now with frontend. Can you please guide me to the right place to change this on BE without affecting the translation to Arabic on BE.
Sorry I mean Backend :)
Thank you. I'll try it, but I think this will affect the Arabic translation in server side which is something I'm not interested in. I don't want to affect the translation on frontend and backend, but only change Locale related to Dates, Currency, etc.
Hi
I'm following your tutorial to add a custom data-filter <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Data-Filters">https://aspnetboilerplate.com/Pages/Doc ... ta-Filters</a> I'm using AspNetZero and noticed it's not easy to support this without pulling Abp source and change it there on AbpDbContext.cs : OnModelCreating(DbModelBuilder modelBuilder)
Do you have a better workaround?
Thanks
Awesome! thanks a lot
Hi @ismcagdas
I was able to add the needed configurations that meet my needs, however I'm still experiencing a problem that's only backend related. When I watch the values during debugging I see the date resolved exactly as needed, but when it returns it from the service to client, it's returned again as Hijri. (I even tried it through POSTMAN to avoid any client side effects)
So I guess it's sort of OWIN Middleware you injected that changes Culture in the pipeline. I noticed you have a method called ThreadCultureSanitizer that's injected in your UseAbp OWIN extension, not sure if it's the right place.
I need your help please to know how and where I can override this behavior. (Note again please that I only use AspNetZero and I don't maintain the source of Abp)
Thanks
Thanks @ismcagdas
Unfortunately, it didn't work for me yet.
I'll provide an example that may help you reproduce it at your side:
Make your language Arabic
Add the culture changing code first lines of any method that returns datetime (like a DTO that inherit from FullAuditedEntityDto) something like: GetSomethingForEdit()
Observe FirstOrDefaultAsync method result to see the datetime values like CreationTime (you should get it Gregorian not Hijri)
Then check the result returned to client side (you'll get it Hijri again)
So there are two problems I'm looking for a solution for:
Thanks