Skip to main content
Tweeted twitter.com/#!/StackWordPress/status/380938448309592064
edited tags
Link
fuxia
  • 107.1k
  • 38
  • 255
  • 459
added 470 characters in body
Source Link
Eric Holmes
  • 3.9k
  • 2
  • 22
  • 35

I have a WordPress multisite, which is in both english and french. On the french site, localization is working great (using date_l18n() for dates, and __(), etc. for the rest).

When an AJAX call sends off to WP and returns data (the same rendering functions being called from initial page load and AJAX), however, they are returning English date values.

Example: Date archive says "septembre 2013". You click the Next Month button, which sends off to AJAX and returns the new month header, and article listing. It's returning "October 2013" rather than "octobre 2013".

Is this a known bug, or should I be submitting this to track?

function render_event_archive_month_header( $date = null, $echo = true ) {
    $date_str = strtotime( $date );
        
    if( ! $echo )
        ob_start();
    
    <?php echo date_i18n('F Y', $date_str ); ?>
    
    <?php
    if( ! $echo ) {
        $data = ob_get_contents();
        ob_end_clean();
        return $data;
    }
}

This is being passed a yyyy-mm-dd date value, like so

render_event_archive_month_header( '2013-10' );

from within my Ajax action callback.

I have a WordPress multisite, which is in both english and french. On the french site, localization is working great (using date_l18n() for dates, and __(), etc. for the rest).

When an AJAX call sends off to WP and returns data (the same rendering functions being called from initial page load and AJAX), however, they are returning English date values.

Example: Date archive says "septembre 2013". You click the Next Month button, which sends off to AJAX and returns the new month header, and article listing. It's returning "October 2013" rather than "octobre 2013".

Is this a known bug, or should I be submitting this to track?

I have a WordPress multisite, which is in both english and french. On the french site, localization is working great (using date_l18n() for dates, and __(), etc. for the rest).

When an AJAX call sends off to WP and returns data (the same rendering functions being called from initial page load and AJAX), however, they are returning English date values.

Example: Date archive says "septembre 2013". You click the Next Month button, which sends off to AJAX and returns the new month header, and article listing. It's returning "October 2013" rather than "octobre 2013".

Is this a known bug, or should I be submitting this to track?

function render_event_archive_month_header( $date = null, $echo = true ) {
    $date_str = strtotime( $date );
        
    if( ! $echo )
        ob_start();
    
    <?php echo date_i18n('F Y', $date_str ); ?>
    
    <?php
    if( ! $echo ) {
        $data = ob_get_contents();
        ob_end_clean();
        return $data;
    }
}

This is being passed a yyyy-mm-dd date value, like so

render_event_archive_month_header( '2013-10' );

from within my Ajax action callback.

Source Link
Eric Holmes
  • 3.9k
  • 2
  • 22
  • 35

WordPress AJAX calls not detecting language properly?

I have a WordPress multisite, which is in both english and french. On the french site, localization is working great (using date_l18n() for dates, and __(), etc. for the rest).

When an AJAX call sends off to WP and returns data (the same rendering functions being called from initial page load and AJAX), however, they are returning English date values.

Example: Date archive says "septembre 2013". You click the Next Month button, which sends off to AJAX and returns the new month header, and article listing. It's returning "October 2013" rather than "octobre 2013".

Is this a known bug, or should I be submitting this to track?