0

I am using the domains module (D6) with multiple domains on a 1 site, and we have multiple languages on 1 domain. (We have to have this set up with no other option). Internationalization string translations is enabled and the translated strings in the t() function are in the database.

The domian language setting overrides the node language setting which causes the string translations not to work when having multiple languages on 1 domain.

I have overridden the domain language setting with the node language setting in the theme template_preprocess_page() function and works well but I think it happens too late in the process as the string translations still don't work.

What do I need to do to get the string translations to work?

function phptemplate_preprocess_page(&$vars, $hook) {
  global $language;

  // Reset Language to Page Node Level
  // Get the list of languages
  $languages = language_list();

  // Set up the new language code
  $new_lang_code = $vars['node']->language;

  // Make sure the required language object is actually set
  if (isset($languages[$new_lang_code])) {

    // Overwrite the global language object
    $language = $languages[$new_lang_code];
  }
  var_dump($language) // $language = node language setting
}

1 Answer 1

0

I have got this working now by moving the code into the preprocess_node() function instead.


function phptemplate_preprocess_node(&$vars, $hook) {
global $language;
$languages = language_list();
$new_lang_code = $vars['node']->language;

 if (isset($languages[$new_lang_code])) {  
  $language = $languages[$new_lang_code];  
 }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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