Month name shown in English on item page, in spite of language settings

I use the NumericDataTypes module to record dates as, well, dates (timestamps).

As the module has not yet been updated with translations from Transifex, I have manually uploaded to the language subfolder the translations files for my language (Italian), and indeed now I see correctly the month names in Italian in the backend. So far, so good.

However, in the front-end (i.e. when visiting the website) I still see month names in English. I have Italian set as the default language of the installation, and I have explicitly set it as language for the specific website. I have tried changing the LC_ settings on the server, but this also does not seem to have any impact.

Ultimately, I don’t see in the translation files available on Transifex the strings that should appear in the frontend, just e.g. in the format "04 — April" used for the backend.

Any suggestions of where do I change this setting? Or hints about where I should try to fix it (in the module, in the theme, elsewhere in omeka, on the server itself?).

thanks!

There is no setting to fix this, nor is there an easy generalizable solution. Internationalizing date strings is tricky. Currently the module renders the date string according to a hard-coded format, which, as you see, favors the American format (month day, year). To fix this for Italian (or any other language, really), you’ll need to edit some classes to reformat and translate the date/time strings, these classes specifically:

  • NumericDataTypes\DataType\Timestamp::render()
  • NumericDataTypes\DataTypeAbstractDateTimeDataType::getDateTimeFromValue()

From there it’s up to your technical knowhow and your server’s capabilities. Perhaps you can use PHP’s IntlDateFormatter, or a combination of setlocale() and strftime(), or maybe you could just localize the render formats in getDateTimeFromValue() and do a find and replace for the month translations.

As you see, date string internationalization is tricky, and certainly hard to generalize, at least in a PHP environment. Sorry there’s no easy fix.

Painful, but helpful, thanks!

I’m running Omeka on its own docker image, so I should probably make sure I have all set up there first, adjust the order of month and day in the files you pointed out, and take it from there with php.

I’ll report back when I figure this out!