Multi-lingual Page Redirect In Drupal

Running websites in Drupal with more than one language, sometimes you send out the wrong link. A quick fix for this, as a 301 redirect will not really change the language, is to do this:

First find out what you have your language code set to. You should be able to look this up in your admin. For example, lets say it was ja for Japanese.

You can then enter this in the node that you want to switch the language on.

<?php
global $language;
if( $language->language == 'ja' ) {
drupal_goto('http://example.com/example');
}
?>

Comments

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.
Creative Commons SRW2D 2012