OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.45k stars 2.41k forks source link

Localization of Date Field #3635

Open aghili371 opened 5 years ago

aghili371 commented 5 years ago

it doesn't show the Persian calendar for the date field. i have enabled localization and i added fa-ir culture too.

hishamco commented 5 years ago

Please screen shoot

sebastienros commented 5 years ago

I think he's talking about the picker itself. When you edit a content item.

hishamco commented 5 years ago

Yep, but I'm not sure if it's built with bootstrap, because this is something different if I'm not wrong

hishamco commented 5 years ago

@sebastienros is the component using bootstrap or jquery-ui or native one?

aghili371 commented 5 years ago

Capture i can't make screen shoot. when you want to select date , it doesn't show Persian calendar.

sebastienros commented 5 years ago

maybe there is a default in-browser editor we could use as a custom editor.

hishamco commented 5 years ago

That's a default browser editor we use custom one that support localization for instance jquery ui datepicker supports many languages including Arabic, Farsi .. etc

sebastienros commented 5 years ago

Looks good to use the jquery one then, ideally as a custom editor at first.

hishamco commented 5 years ago

This will need the following:

FYI there 're two options for datetime picker localization script: 1- Script per language which is better in term of Perf 2- Scripts for all the supported languages (which is the preferred option for us)

hishamco commented 5 years ago

After little investigation seems jquery-ui support datetime localization only. BTW I found another cool library that supports localization & calendars too but it needs more investigation, so for that I'm suggesting the following:

1- Add jQuery-UI date picker as a custom editor as @sebastienros mentioned before 2- Integrate the new date picker, with specifying the calendar and language as settings (which will fix #3664) 3- Mapping the date picker calendars with the one that we already have and support

FYI: the priority for step 1, other step may added in 1.1.0 as improvements, but if we have time we can do it in 1.0.0

hishamco commented 5 years ago

@aghili371 the PR #3707 added a localized version of datetime picker, @sebastienros can we make this open until we finish other steps, or shall we make the improvements after 1.0.0 milestone?

aghili371 commented 5 years ago

it still doesn't work.

hishamco commented 5 years ago

@aghili371 the localized date-picker should should the name of the Persian days, months and years if the culture set to fa-IR, don't confuse with Persian calendar which is still not integrated with the date-picker

Skrypt commented 5 years ago

Create a SiteSettingsCalendarSelector that would override the DefaultCalendarSelector that uses the calendar that comes from the current culture.

https://github.com/OrchardCMS/OrchardCore/blob/dev/src/OrchardCore/OrchardCore/Localization/DefaultCalendarSelector.cs#L14

That SiteSettingsCalendarSelector would return a calendar type that has been saved in the SiteSettings.

hishamco commented 5 years ago

As we discussed in gitter, if date picker should uses the SiteSettingsCalendarSelector unless overriding need. For instance if the SiteSettingsCalendarSelector provides GregorianCalendar, may I will override that and use HijriCalendar for specific date pickers

sebastienros commented 5 years ago

I see online that there are different date pickers based on the calendar. Maybe we should have an international date picker that can adapt to the current culture, or/and provide custom editor for the date field that lets us select which picker to use. In the end the date would still be stored with a DateTime value.

hishamco commented 5 years ago

@sebastienros can reschedule the enhancements that I mentioned in my comment https://github.com/OrchardCMS/OrchardCore/issues/3635#issuecomment-496006787 to target 1.1