I'm using the archive view to show a monthly archive of news items. However, the default language for my site is Dutch but the names of the months, as shown in the archive-view, are in English. How can I get the names of the months to be shown in my own language?

CommentFileSizeAuthor
#2 archivo2.txt4.55 KBjotarp

Comments

pvanderspek’s picture

I'm actually not sure whether this is Views or Date related. Although I want to translate the values for the Date CCK field, similar translations should be possible for default Drupal fields like the node creation date. In any case, a similar question has been posted in the issue queue of Date: http://drupal.org/node/418184

jotarp’s picture

StatusFileSize
new4.55 KB

With views-6.x-2.3, I add a new 'archive' view to get summary sort DESC. It's the archivo2.txt attached file.

To translate titles (dirty hack):
1. cp modules/views/theme/views-view-summary.tpl.php your-theme-directory/views-view-summary--archivo2.tpl.php

2. Change this line:

<li><a href="<?php print $row->url; ?>"><?php print $row->link; ?></a>

for:

<li><a href="<?php print $row->url; ?>"><?php print substr($row->link,-4) .'-'. t(substr($row->link,0,-5)); ?></a>

3. Check that the names of months are translated in /admin/build/translate/search

I guess you can get a similar hack with default 'archive' view.

halfiranian’s picture

Thanks Jotarp,

Does anyone know if there's a 'proper' way of doing this, using the i18n/locale module? I've got lots I need to translate so the above method is not really sustainable

Thanks

esmerel’s picture

Component: User interface » Translations
dawehner’s picture

Status: Active » Fixed

See the code of format_date. This should be possible already

    $c = $format[$i];
    if (strpos('AaDlM', $c) !== FALSE) {
      $date .= t(gmdate($c, $timestamp), array(), $langcode);
    }
    else if ($c == 'F') {
      // Special treatment for long month names: May is both an abbreviation
      // and a full month name in English, but other languages have
      // different abbreviations.
      $date .= trim(t('!long-month-name '. gmdate($c, $timestamp), array('!long-month-name' => ''), $langcode));
    }

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.