monpoulet Posted February 27, 2015 Share Posted February 27, 2015 (edited) Hi Guys, I am developing a module and I have the texts of my template translated, excluding the long date (eg. lundi 02 mars) ! I have discover that my date variable is translated in French and in Spanish, but not in English. Try to add this to a template: {$smarty.now|date_format:'%A %d %B'} When you switch From French to English, the French long date is appearing ! And when you switch to Spanish, the long date is corrected translated in Spanish ! I have tried to add the "setlocale" in my module, but nothing happen, except that "en_US" is doing a 500 error.... Here is how I have forced the setlocale in my module: $lang = $this->context->cookie->id_lang; if($lang == 1) setlocale(LC_TIME, 'fr_FR.UTF-8', 'fr_FR.utf8'); elseif($lang == 2) setlocale(LC_TIME, 'en_EN.UTF-8', 'en_EN.utf8'); elseif($lang == 3) setlocale(LC_TIME, 'es_ES.UTF-8', 'es_ES.utf8'); The cookie value is ok, I checked. Any idea to correct this ? PS 1.6.0.1 with the French, English and Spanish installed. Edited March 19, 2015 by monpoulet (see edit history) Link to comment Share on other sites More sharing options...
tuk66 Posted February 28, 2015 Share Posted February 28, 2015 Try en_GB.UTF-8 or en_US.UTF-8 http://stackoverflow.com/questions/3191664/list-of-all-locales-and-their-short-codes 1 Link to comment Share on other sites More sharing options...
monpoulet Posted February 28, 2015 Author Share Posted February 28, 2015 Hi M4, Thank you for replying, but I have also a 500 error.Here are the lines: Invalid dateat line 689 in file classes/Tools.php and here is the code: 688. if (!Validate::isDate($date) || !Validate::isBool($full)) 689. throw new PrestaShopException('Invalid date'); I think it's a bug in the core of Prestashop as it's working in Spain and in French. Or should the date espacially formatted from a time stamp for US ? Best regards, Marc Link to comment Share on other sites More sharing options...
monpoulet Posted February 28, 2015 Author Share Posted February 28, 2015 Just a precision: I have tested on the server, but "outside" Prestashop, it's working. Have a try: call this: strftime("%A %d %B", '1425147349') in php It should show: in french: Samedi 28 février in spanish: Sábado 28 febrero in english: Saturday 28 February In english it gives me a 500 error ? A new bug of PS 1.0.6.11 ? May a Super-Extra-Admin have a look ? Link to comment Share on other sites More sharing options...
monpoulet Posted March 2, 2015 Author Share Posted March 2, 2015 Up ? Link to comment Share on other sites More sharing options...
Gregory Roussac Posted March 18, 2015 Share Posted March 18, 2015 Hi, Sorry I do not undertand your point. https://github.com/PrestaShop/PrestaShop/blob/1.6/config/smarty.config.inc.php#L69 I believe |date_format is a smarty function, not specifically a call to Tools ? What is the 500 error saying ? I believe your server may not have the en/us locale ? Regards Link to comment Share on other sites More sharing options...
monpoulet Posted March 18, 2015 Author Share Posted March 18, 2015 Hi Gregory, The server has the local en/es, because it's works outside Prestashop, on the same server. If you read this topic, you will see what the server says... Link to comment Share on other sites More sharing options...
Gregory Roussac Posted March 19, 2015 Share Posted March 19, 2015 Hi, Well sorry I read your point, but I do not understand it. again it is a smarty function, I can not see why you link it to the Tools class. We do setlocale so maybe this is in cause. You need to overwrite it probably in a smarty modifier. https://github.com/PrestaShop/PrestaShop/blob/1.6/config/config.inc.php#L140-L143 http://www.smarty.net/forums/viewtopic.php?p=68792&sid=d2df0dbaad616aedc03e28f9f55ef1c8 Regards 1 Link to comment Share on other sites More sharing options...
monpoulet Posted March 19, 2015 Author Share Posted March 19, 2015 Thank you Gregory. Marc Link to comment Share on other sites More sharing options...
MrEduar Posted November 16, 2021 Share Posted November 16, 2021 (edited) Hello @monpouletHow are you doing? I know this is a super old topic, but I am having exactly the same problem as you are currently having with date translations and maybe by some miracle you will see this message in time. Apparently smarty is not able to translate the month of December for me and therefore does not show the date. This is the format I am using "%e %b %Y" when it is in French it does not show, but in English it shows the date correctly. I tried changing the format to %e %Y and in both languages it shows the date correctly, so the problem comes with the translation of December to French. He also has problems with these months Février and Août, they all have an accent including Décembre In English But in French Edited November 16, 2021 by MrEduar (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now