Skip to content

i18n: dates - IntlDateFormatter, drop the five duplicated month and day arrays #240

Description

@agilare

French month and day names are hardcoded in librairies/Utils/DateHelper.php, in four static arrays plus a fifth in app/config.php.

Skip this issue entirely if #219 has landed with the i18n constraint — that is the natural place for this work.

The duplicates

Location Array
DateHelper.php:123 day names, in isoToDayName()
DateHelper.php:135 month names, in monthName()
DateHelper.php:150 abbreviated month names, in monthNameShort()
DateHelper.php:172 day names and month names, redeclared locally inside isoToFr()
app/config.php:91 $glo_moisF, capitalized, unlike the others

ext-intl is available locally and on the host, so IntlDateFormatter supplies all of these and the component order per locale. All five arrays go.

What IntlDateFormatter does not do

The ICU fr pattern yields 1 avril and 20:30. isoToFr() currently produces 1<sup>er</sup>&nbsp;avril and 20h30, and both forms are part of the agenda house style.

So: IntlDateFormatter for the localized names and ordering, with the ordinal and the 20h30 time format kept as a French exception layered on top, not as the general case.

Signature becomes isoToLocale(string $date, string $locale, ...); isoToFr() stays as an @deprecated alias.

Watch-outs

hCalendar. The Google parser reads the element text, and a previous mistake here produced ~3700 Search Console errors. Check that an English date does not replay it — freezing the microformat as <abbr title="ISO"> if need be.

isoToApp() / appToIso() use the Swiss DD.MM.YYYY form in the edit forms and the Zebra datepickers. The back-office stays French, so leave them alone.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    MAverage amount of workPriority : lowpriorityi18nInternationalization and localizationrefactoring

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions