views:

401

answers:

1

In a Drupal multilingual site, for custom modules, (not nodes) what is approach to assure that user navigates to same page in new language?

example: en/mypage to de/mypage

edit: menu hook looks like this:

  // add menu item
  $items['my_module_name'] = array(
     'title'            => t('My Page Title'),   
     'menu_name'        => 'menu-my-menu',       
     'page callback'    => 'call_this_function_below',   
     'access arguments' => array('access content'),         
  );
A: 

You mean how to program a module with multilanguage support? Well, I would say you use a placeholder in the menu path you are registering your module for (hook_menu). In that way your module will get the request no matter what language identifier is used, so it will react for en/mypage as well as de/mypage. Of course in your module you must add custom processing logic to deliver the content in the requested language.

Sebi
language buttons have href of "en" , "fr' or "de". Is it possible to catch this and use a hook menu or hook alter to globally redirect user to appropriate content?
ernie
Yes, of course. However, if you catch those requests you disable the built-in mechanism of language handling. A fair guess is that this will bring you a lot additional trouble.
Sebi
OK. not sure I am following. Hitting language button sends value of "fr" or "de". I am not sure how it knows to go to same page in other language.
ernie

related questions