WordPress.org

Make WordPress Core

Opened 11 years ago

Closed 10 years ago

#12351 closed defect (bug) (wontfix)

Date Localization is a pain with date() syntax

Reported by: brodock Owned by: nbachiyski
Milestone: Priority: normal
Severity: normal Version: 2.9.2
Component: I18N Keywords:
Focuses: Cc:

Description

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

Change History (2)

#1 @nacin
10 years ago

  • Milestone 3.0 deleted
  • Priority changed from high to normal
  • Severity changed from major to normal

I don't think there would be any traction to move from date() to strftime().

#2 @nbachiyski
10 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

We will stay with date().

Trying to use system locales has been a dister in the past. Too many server with different set of installed locales and different versions of locales.

Note: See TracTickets for help on using tickets.