- July 15, 2017 at 7:53 pm #20682aurelrobertJuly 15, 2017 at 7:53 pmMonth of articles publication date not properly translated
I am not able to display publication dates in french: the month is displayed as the 3 first characters of the month in english.
I have fixed the issue by adding some code to map english months to french months but I have to do the same fix each time I am upgrading the theme.
Do you have an option to fix this issue permanently?
regardsJuly 17, 2017 at 10:05 am #20687iceableJuly 17, 2017 at 10:05 amReply to: Month of articles publication date not properly translated
iceableKeymasterSupportHappy with my help?
Buy me a beer!
Thanks for reporting this issue. I just reviewed this portion of the code and found that the month part of post dates was indeed missing internationalisation support.
This will be fixed to the next update (1.2.13) so you will not have this issue anymore when updating.
For the record, the month part of post dates is currently rendered with this code in both index.php and single.php:
?><span class="month"><?php the_time('M'); ?></span><?php
This only returns the month in a 3-letters formats, in english.
I will update this will the following code, which will automatically display the month as 3 letters in the current language of the website, as defined in Settings > General > Site Language (this will work in every language supported by WordPress, with no mapping necessary!):
?><span class="month"><?php echo date_i18n( 'M', strtotime( get_the_time('Y-m-d') ) ); ?></span><?php
Code reference: https://codex.wordpress.org/Function_Reference/date_i18n
On an unrelated note to answer your “I have to do the same fix each time I am upgrading the theme.” concern:
Any change you make directly in any of the theme’s file will be overwritten during updates (updates in WordPress actually delete all files and replace them by unzipping the new version’s package).
This is why you should not edit files directly but use a child theme instead when you need to make changes or customizations: files in a child theme effectively override files from the parent theme, but are not affected by updates.
You must be logged in to reply to this topic.