1

I'm using the i18n module and Views. I have a separate view for each language and the language menu obviously doesn't line up for each of those views. I want to be able to adjust the links for the language menu when I'm on each of those view pages so they map to the corresponding view in the other language?

Where/how would I adjust those links? Would it be something in the template.php file for the theme or should I do it in a custom module?

0

I'm certain there is a better way to do it than this...it's a little brute-force, but it gets the job done for me:

function THEME_preprocess_page(&$variables) {
  $markup = $variables['page']['my_region']['locale_language']['#markup'];

  // Do some string replaces on $markup to adjust the URLs

  $variables['page']['my_region']['locale_language']['#markup'] = $markup;
}

I know this isn't the Drupal way to do this. Part of the problem is that I only need to adjust the language links on a few Views pages, so figuring out how to do this in hook_menu_alter or in a module was too complicated...I needed a quick solution.

I'm hoping someone can pos the Drupal way of achieving this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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