Hi,

I've a problem with the function "theme_date_display_range" from date.theme.
It's used for date and time range, but the word "to" is not always the same in somes languages between "time" and "date".

Exemple :

16/02/2014 to 10/02/2015 (english)
16/02/2014 - 10:00 to 15:00 (english)

16/02/2014 au 10/02/2015 (french)
16/02/2014 - 10:00 à 15:00 (french)

This theme function need to be called with a context.

Below my suggestion (+ the patch) :

l.175

  elseif ($has_time_string && $dates['value']['formatted_date'] == $dates['value2']['formatted_date']) {
    // Replace the original time with the start/end time in the formatted start
    // date. Make sure that parentheses or brackets wrapping the time will be
    // retained in the final result.
    $time = theme('date_display_range', array(
      'date1' => $time1,
      'date2' => $time2,
      'timezone' => $timezone,
      'attributes' => $attributes,
      'rdf_mapping' => $rdf_mapping,
      'add_rdf' => $add_rdf,
      'microdata' => $microdata,
      'add_microdata' => $add_microdata,
      'dates' => $dates,
      'context' => 'time',
    ));
    $replaced = str_replace($time1, $time, $date1);
    $output .= theme('date_display_single', array(
      'date' => $replaced,
      'timezone' => $timezone,
      'attributes' => array(),
      'rdf_mapping' => array(),
      'add_rdf' => FALSE,
      'dates' => $dates,
    ));
  }

l.329

  // Wrap the result with the attributes.
  return t('!start-date to !end-date', array(
    '!start-date' => $start_date,
    '!end-date' => $end_date,
  ), ( isset( $variables[ 'context' ] ) ? array( 'context' => $variables[ 'context' ] ) : array() ));
CommentFileSizeAuthor
date_time_translation_patch.patch618 bytesraphaeltbm
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

raphaeltbm’s picture

Status: Active » Needs review
drupaleye’s picture

How can I translate/change the word "to" after applying this patch?

[edit] I found it after searching for "!start-date to !end-date". Thanks!

Chris Matthews’s picture

Version: 7.x-2.8 » 7.x-2.x-dev
Status: Needs review » Needs work

The 3 year old initial patch to date.theme does not apply to the latest 7.x-2.x-dev may be too old to reroll, but I went ahead and tagged the issue accordingly.

Checking patch date.theme...
error: while searching for:
      'microdata' => $microdata,
      'add_microdata' => $add_microdata,
      'dates' => $dates,
    ));
    $replaced = str_replace($time1, $time, $date1);
    $output .= theme('date_display_single', array(

error: patch failed: date.theme:186
error: date.theme: patch does not apply