[wp-trac] [WordPress Trac] #12351: Date Localization is a pain with date() syntax

WordPress Trac wp-trac at lists.automattic.com
Tue Feb 23 20:04:32 UTC 2010


#12351: Date Localization is a pain with date() syntax
--------------------------+-------------------------------------------------
 Reporter:  brodock       |       Owner:  nbachiyski
     Type:  defect (bug)  |      Status:  new       
 Priority:  high          |   Milestone:  3.0       
Component:  i18n          |     Version:  2.9.2     
 Severity:  major         |    Keywords:            
--------------------------+-------------------------------------------------
 Because Wordpress makes use of Date syntax, non english languages has to
 scape every single character it wants to print, so dates can make sense.

 Here is a plain example of how things are done to get date in portuguese:

 echo(date('j \d\e F \d\e Y'));

 Will print:

 23 de February de 2010
 (also found that you guys make some magic to transform 'February' to
 'Fevereiro')

 If instead of date functions we use strftime syntax:

 setlocale(LC_ALL, 'pt_BR.UTF-8');
 echo(strftime('%d de %B de %Y')."\n");

 it will print the right way:

 23 de Fevereiro de 2010

 Without messing up the input with escape characters that then, have to be
 dealed with php's addslashes, etc.

 Also by the current implementation, sometimes at random (I believe it's
 related to "blog upgrade", blog default date format lose it's escaping
 characters printing instead:

 23 de February de 201023 23America/Sao_Paulo February 23America/Sao_Paulo
 2010

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12351>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list