﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
23056,date_i18n() does not localize dateformat 'r',jrf,,"The weekday and month strings in a date being formatted with the 'r' format character are not being localized.

I've looked at the [http://core.trac.wordpress.org/browser/trunk/wp-includes/functions.php trunk code] and it looks like the 'r' case is not being considered at all in the [http://codex.wordpress.org/Function_Reference/date_i18n date_i18n()] function.


This bug is very easy to reproduce:
{{{
print ( date_i18n( 'r', 972144067 ) );
}}}

Expected output for language Dutch:[[BR]]
''za, 21 okt 2000 16:01:07 +0200''

Received output:[[BR]]
''Sat, 21 Oct 2000 16:01:07 +0000''



== Potential patch: ==

A bit of a hacky patch would go along the lines of:

{{{
if( !function_exists( 'patch_date_i18n' ) ) :
add_filter( 'date_i18n', 'patch_date_i18n', 10, 4 );
function patch_date_i18n( $formatted_date, $req_format, $timestamp, $gmt ) {

	if( $req_format !== 'r' )
		return $formatted_date;

	global $wp_locale;
	$datefunc = $gmt? 'gmdate' : 'date';

	$find = array (
		$datefunc( 'M', $timestamp ),
		$datefunc( 'D', $timestamp ),
	);
	$replace = array(
		$wp_locale->get_month_abbrev( $wp_locale->get_month( $datefunc( 'm', $timestamp ) ) ),
		$wp_locale->get_weekday_abbrev( $wp_locale->get_weekday( $datefunc( 'w', $timestamp ) ) ),
	);
	return str_replace( $find, $replace, $formatted_date );
}
endif;
}}}

Hope this helps. Would be great if this could be fixed.

Smile,
Juliette
",defect (bug),new,normal,Awaiting Review,I18N,1.5,normal,,,trac.wordpress.org@…
