You are here

function i18n_node_i18n_context_language in Internationalization 7

Implements hook_i18n_context_language().

File

i18n_node/i18n_node.module, line 100
Internationalization (i18n) module - Node type handling

Code

function i18n_node_i18n_context_language() {

  // Node language when loading specific nodes or creating translations.
  if (arg(0) == 'node') {
    if (($node = menu_get_object('node')) && !empty($node->language) && i18n_node_type_enabled($node)) {
      return i18n_language_object($node->language);
    }
    elseif (arg(1) == 'add' && !empty($_GET['translation']) && !empty($_GET['target']) && ($source = node_load($_GET['translation'])) && i18n_node_type_enabled($source)) {
      return i18n_language_object($_GET['target']);
    }
  }
}