Here is another drupal i18n beast. I have nice taxonomy summary for a category of shops. Which is attachment for a view, which passes term to it to filter category and show only shops that are in that category. Looks nice, it is moderately useful and seems it has never been done before. Search for something similar never came up in google, only a rather useful post that deals with similar stuff, only much simpler, people want to translate term title. Ahh term title I eat for breakfast :-) Anyway there are few useful code examples here http://drupal.org/node/346028 that could lead you in right place if you are struggling.
So this is the deal. There are 2 ways you can use your taxonomy with multi language, either you localize your terms, or you translate them. When you translate them you in fact make a term for each language and then connect them with translation sets for possible future connectivity. This is not a bad solution, only you have much more terms in your taxonomy and in some cases more work, to change terms for all of your nodes. And then again you come to views and there is not much support for it there, even less in fact.
Then I choose localize, you "translate"(great naming drupal people, really no confusion there ehhh) or maybe I should say localize, but what you do is translate :-) without creating new terms, you translate strings. And then you refresh strings and you realize all of your localization has disappeared, why? Seems there is some glitch when you migrate from drupal 6 to drupal 7 and I had to re-save all of the taxonomy terms so they don't get deleted when you refresh, maybe this is also due to changing from localize->translate mode of taxonomy, don't know. Anyway this can happen do try before enter all of them.
Anyway I localize, so then what? To have some view display, install i18n views module, there are some filters and relationships etc but not much help there for my case. I created separate views for each language (maybe this is to much, but from experience it was often necessary, either that or some hacking again). And then add attachment, added page. In fields you add normal field, just under formatter you choose "localize" and this works for views! But then there is this summary part, how to make this thing show other languages? There was no way to make it happen. So in the end I had to do some custom stuff. I installed custom template, default template for summary is views-view-summary-unformatted.tpl.php, my view name is
views-view-summary-unformatted--negozi--attachment_1.tpl.php for Italian, and
views-view-summary-unformatted--shops--attachment_1.tpl.php for English. So this is what I added to my theme. You can also use default template, but then all of your summary would be overriden, and this is a problem if you have more as code we are going to add will try to translate everything, and if you have some numbers, of alphabet summaries, then you will get empty values. So the code is
<?php foreach ($rows as $id => $row): ?>
<?php print (!empty($options['inline']) ? '<span' : '<div') . ' class="views-summary views-summary-unformatted">'; ?>
<?php if (!empty($row->separator)) { print $row->separator; } ?>
<a href="<?php print $row->url; ?>"<?php print !empty($row_classes[$id]) ? ' class="' . $row_classes[$id] . '"' : ''; ?>><?php print i18n_string('taxonomy:term:'.$row->taxonomy_index_tid.':name',$row->taxonomy_term_data_name);
?></a>
<?php if (!empty($options['count'])): ?>
(<?php print $row->count; ?>)
<?php endif; ?>
<?php print !empty($options['inline']) ? '</span>' : '</div>'; ?>
<?php endforeach; ?>
Main line here is
print i18n_string('taxonomy:term:'.$row->taxonomy_index_tid.':name',$row->taxonomy_term_data_name);
Which in fact translates term(s) to current language. That is all and it works. Other solution would be to use this or something similar in template.php and pre-process view but it takes more work there and more code. So this is better for me. Anyway final result is here
tower-center-rijeka.hr/it/attivita/13 and it seems like I am again pioneer in some things, would be nice if this things worked from out of the box, maybe drupal 8 and all that entity stuff solves it? hope so, but this is getting more and more complex.
Seems like I don't eat titles for breakfast, There is another override needed for that. You could again do that in some template where you need it but this time lets do it over template.php So we then add this to template.php
function tower_views_pre_render(&$view) {
//the following translates taxonomy_term views titles, assuming they're being set by the argument handler
dpm($view);
if($view->current_display == 'page_2') {
if($view->name == 'negozi') {
if(isset($view->args[0])) {
$tid = $view->args[0];
$view->build_info['title'] = 'Attivita'.i18n_string('taxonomy:term:' . $tid . ':name', drupal_get_title());
}
}
}
}
We check for view name and view display (page_2) and then make a new title that will be used for both body and meta part of page.