Views titles and text and i18n, a preliminary preface to a dirty hack
Internationalization module (i18n) now supports views in a way-- unfortunately I think it hard wires in the
sure how well that works with the preferred "show current language and no language" setting.
And there's still no goddamned "show in the user's preferred language if available, if not in the default language." That's what we need. There shouldn't even be a conceptual hack of "no language" – content is either in a language or it isn't. But all that's another story.
Views.module is not compatible with i18n
http://drupal.org/node/65722
Integration of i18n and views.module = fix translatablity of views
http://drupal.org/node/64004
And the one we're trying to deal with:
i18n Translation and Views: Header/Footer
http://drupal.org/node/89100
A workaround that involves hacking views is offered by JordiTR (May 17, 2006):
I've been facing that trouble on the last two weeks, asking everywhere without solution and it's neither a views.module nor a i18n.module. There are two issues easy to solve:
- the content: needs that you play with Content selection mode on the i18n configuration page, what works best for me is Only current language and no language
- the block title: I've customized the views.module with an extremelly small hack which consists on changing on line 1067 (function views_view_block($vid)) the expression $block['subject'] = '$view->title'; with $block['subject'] = t($view->title); that forces your custom name to that concret view to pass through the locale translator of strings; form here on, after the first time you load that view on your optional language it will add an entry on the locale table which will ready to be translated (and it works!!!) :-)
As far as I know there's no solution in Drupal 5 either.
Places like this will use the tt() function in Drupal 6 for dynamic translatable strings, and maybe this is in the experimental i18n modules Agaric turned off on WSF because they broke the ability to rename custom content (CCK) types.
If we patch views, can we at least do it right and use a call to tt() instead of t() ?
Comments
Dirty hacks preferred to
Dirty hacks preferred to experimental i18n modules. This change made to
around line 435 (Drupal 5, final version of Views 1)
if ($content) {
$block['content'] = $content;
// original:
// $block['subject'] = filter_xss_admin(views_get_title($view, 'block'));
// replacement... this is oh so wrong
$block['subject'] = t(views_get_title($view, 'block'));
return $block;
}
More subtle and simple solution
Because views can be manipulated in the views argument area you can add this there to solve the problem...
$views->page_title = t($views->page_title);
Post new comment