Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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() ));
Comment | File | Size | Author |
---|---|---|---|
date_time_translation_patch.patch | 618 bytes | raphaeltbm | |
Comments
Comment #1
raphaeltbm CreditAttribution: raphaeltbm commentedComment #2
drupaleye CreditAttribution: drupaleye commentedHow can I translate/change the word "to" after applying this patch?
[edit] I found it after searching for "!start-date to !end-date". Thanks!
Comment #3
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 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.