I'm using Types and I'm not able to have the month of the date with the correct translation. My WordPress parameters are j F Y and my site is in French, but the result of the date is : 15 November 2014 !
The issue for me is that I'm using this date within a hook. So, I'm getting the date from the postmeta in order to integrate it in the post title and don't know how to translate it into French in the function.
I have tried to use this code :
setlocale(LC_TIME, 'fr', 'fr_FR', 'fr_FR.ISO8859-1');
$value2 = strftime ( "%d %B %Y" , get_post_meta( $plannings, 'wpcf-pl-date', true ));
But the date included in the title is still in English.
Any other idea?
Regards
Pat
Please consider using _e() function, since it will look for available translation (based on language) in the system and will return the correct one. Like:
Please notice the use of _e() function above, as well as, remember to change 'your-text-domain' accordingly. Since get_post_meta() simply returns what is saved in the database. Filtering it through the _e() will get it through the correct (available) translation.
Please let me know if it works, or we can look into more details.
The 'text-domain' is an optional parameter, you can omit this if you are unsure. However, this is primarily used to group certain types of strings.
For example, 2 different plugins can use the same string for their purposes, but to keep 'em separate from a conflict, the 'text-domain' is used. Your theme, should define a text-domain (you can find it in functions.php).
Generally, it should work without the text-domain, please give it a try.
I'm not using any plugin for translation. My site is define with the FR (French) language and it should work fine normally. In fact, everything is fine in the front end, but in the backend and in the hooks, the date is always in English.
Any idea?
Regards
Pat
I just discussed this with my seniors and they suggested to use date_i18n() of Word Press Codex. Please consider following (your) code, altered accordingly:
Thanks for your support. Unfortunately, this is stil not working with your new code, the date in the title is stil in English !
I have also upgraded to the last version of Toolset plugin, but this has not changed anything.
May I ask for a temporary access to your website? So I can look into further things. I have set your next reply as Private, please input all relevant information in that area.
Also, please remember to take full backup of your website (site + database) before providing the access, I may need to change a few things, if needed.