date_i18n() issue

I’m trying to use date_i18n() to display a localised date in my theme.

<?php echo date_i18n( 'F j, Y',  strtotime( get_the_time( "Y-m-d" ) ) ); ?>

However, this always returns the English version of the month, rather than the French version. I’m using wordpress as a network. My primary site has the default WPLANG (so english), and I’m setting the second site to french by setting the WPLANG to fr_FR in site-settings.

Other translations on the page are working fine, so wordpress is aware that the language is different.

I downloaded the necessary .mo and .po files for French, but it doesn’t have months in there, so I assume there’s somewhere else these are set/used.

Any help would be appreciated as I’ve been stumped by this for hours.

1 Answer
1

date_i18n() gets month from WP_Locale->get_month(). Which in turn fills months using baseline translation function __(), nothing fancy.

Bottom line is — months should be translated in po/mo files, you just got incomplete translation.

Leave a Comment