0

I need the months in views' default archive view to display in a different language, just changing the language in Drupal doesn't seem to be helping, string overrides in settings.php aren't doing the trick either. I also tried downloading and importing the views language file but that too has failed. Where can I make this change?

0

1 Answer 1

1

Well, if you have tried all those options, what if you try to replace the respective values from a common view template, using for example, preg_replace() PHP functions, to change this values?

for example: Here is the part of views-view-unformatted.tpl.php when each result is printed:

<?php foreach ($rows as $id => $row): ?>
  <div class="<?php print $classes[$id]; ?>">   
    <?php print $row; ?>
  </div>
<?php endforeach; ?>

you can use a custom views-view-unformatted.tpl.php specific to your view, and use preg_replace() to detect and replace any specific term in $row, according terms that you want. for example

<?php
$string = $row;
$patterns = array();
$patterns[0] = '/jan/';
$patterns[1] = '/feb/';
$patterns[2] = '/mar/';
$replacements = array();
$replacements[2] = 'othermar';
$replacements[1] = 'otherfeb';
$replacements[0] = 'otherjan';
echo preg_replace($patterns, $replacements, $string);
?>

see preg_replace() to get more details. I guess that you can use Devel module to see impact of this way against your site performance.

I hope information be useful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.