date_i18n always returns English names for day and month
-
In the header of my theme, I am displaying the current date in a written out format, at the top right side. The site is multilingual and the date language should change with the user locale. This used to work at one point, but it no longer does.
There have been no changes to this part of the theme code since. The site has only received maintenance updates (major and minor WordPress versions; plug-in updates). It is currently on WP 5.0.3.
I updated the language files for the secondary language (Dutch) with those from the 5.0.3 NL install package, to no avail.
This is the code in the theme for outputting the date:
date_default_timezone_set('Europe/Brussels'); echo date_i18n( get_option( 'date_format' ));
In English (/en/) the date reads:
Monday, 28 January 2019In Dutch (nl_NL; /nl/), it should read:
Maandag 28 january 2019But instead, it reads:
Monday 28 January 2019It is using the date formatting from the WordPress settings (I’m using PolyLang by the way). This is working correctly: when using Dutch for the locale, the comma in the date is omitted.
Currently, I’m at a loss for what else to check for…
- This topic was modified 5 years, 10 months ago by .
- This topic was modified 5 years, 10 months ago by .
The page I need help with: [log in to see the link]
- The topic ‘date_i18n always returns English names for day and month’ is closed to new replies.