Skip to content

Instantly share code, notes, and snippets.

@gavinblair
Created September 30, 2010 21:26
Show Gist options
  • Save gavinblair/605351 to your computer and use it in GitHub Desktop.
Save gavinblair/605351 to your computer and use it in GitHub Desktop.
Multilingual Module Pages in Drupal
<?php
function mymodule_menu(){
$languages = language_list('enabled');
$items = array();
foreach ($languages[1] as $lang) {
$items[t('my_path', array(), $lang->language)] = array(
'title' => t('Page Title', array(), $lang->language),
'page callback' => 'pagefunction',
'access arguments' => array('access content'),
'type' => MENU_NORMAL_ITEM
);
}
}
@SeanJA
Copy link

SeanJA commented Sep 30, 2010

is there a language list file?

@gavinblair
Copy link
Author

no, in drupal that function gives you all active languages, configured in the backend.

functions used:
http://api.drupal.org/api/function/hook_menu/5
http://api.drupal.org/api/function/language_list/6
http://api.drupal.org/api/function/t

@gavinblair
Copy link
Author

turns out this is a very very bad idea...

@SeanJA
Copy link

SeanJA commented Feb 9, 2011

Bahaha... why?

@gavinblair
Copy link
Author

Menu items (in each language) seem to show up no matter what language you're in. Can't specify language of menu items created with hook_menu(), and even manually changing it doesn't do anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment