Hello. I've tried to translate the pager tag labels with "translate view". I've filled up the fields in "translate view", but the label values that remained are from fields from the "pager options". What could be cause of that?

Comments

dawehner’s picture

Status: Needs review » Active

There are probably other issues with the same kind of problem already, but updating the status to active, as needs review means that there is a patch.

joel_osc’s picture

We are seeing this too...the odd thing is that it is only happening on one view on the site. The others are translated the exact same way and they work fine. I will clone the non-working view and start simplifiing it down to try to debug it further.

That being said there is a temporary workaround using hook_views_pre_render as follows:

function mymodule_views_pre_render(&$view) {
  if ($view->name == 'myviewname') {
    if (get_class($view->query->pager) == 'views_plugin_pager_full') {
      $strings = array('next' , 'last', 'previous', 'first');
      foreach ($strings as $string) {
        $name = 'views:' . $view->name . ':' . $view->current_display . ':pager:tags:' . $string;
        $view->query->pager->options['tags'][$string] = i18n_string($name, $view->query->pager->options['tags'][$string]);
      }
    }
  }
}
jonne.freebase’s picture

Thanks for your code joel_osc , I just hit the same issue and your workaround seems to work.

Jason Dean’s picture

I was running into this problem with all views on an multilingual site, and #2 did the trick. Thanks :)

vacilando’s picture

Version: 7.x-3.5 » 7.x-3.7

Same problem in the current stable version: 7.x-3.7

blacklabel_tom’s picture

Issue summary: View changes

This fixed the issue for me in 7.x-3.7

Cheers

Tom

franckylfs’s picture

This fixed the issue for me too, but in 7.x-3.8.

Thanks!

Francky

yannickp4’s picture

Hi to all,

Where exactly do you put that code from #2? In which directory/file?

Thanks,

Yannick

joel_osc’s picture

You would create your own custom module, nothing too complex - just a .info file and a .module file.

eigentor’s picture

I have had the same problem and I think I found the reason and a solution.
In my case I had, as the issue author, Internationalization Views https://www.drupal.org/project/i18nviews

The problem appears to be, that this module has to decide, if a view's original language is english or another language. If the original language is english, everything appears to work. But if the original language is not english, you are basically lost. You cannot translate anything in this case. The hook_views_pre_render may work around this.

I did not find out how one can change the orignal language of a view. It is not exported with features and so I guess not exposed to ctools and maybe not even inside views. It will probably be somewhere i18n.

So what I did is I disabled Internationalization Views and everything was translatable.

What is more: when the module was enabled I had the strange behaviour that many views strings had to be translated from german to english instead of the other way round. After I disabled the module this was gone and everything is translated from english to [your_second_language]

Of course one has to make sure when one exports the features that one has the interface language set to english, but this is a known problem. Else you export the translated strings into features and it is broken again.

kbrinner’s picture

Used this workaround successfully when running views 7.x-3.13.

Both of these views were created before I enabled any translation or internationalization modules, so maybe this has something to do with eigentor's point above about the View's original language.

fgjohnson@lojoh.ca’s picture

Having this issue with the "ALL" exposed.
We can translate to "Tout" but that breaks the filter.

Code in #2 only addresses next/last/previous/first..
In our case we only need the "items-per-page=All" component.
In the pager we can use the default label, or assign one.
But neither "label" seems to be translatable.