0

I have a bilingual website set as two different subdomains (fr.domain.com and en.domain.com) and a custom module for content-aware language switcher link in the main menu (i.e. if I'm on fr.domain.com/article-in-french and click on the "English" link I get sent to en.domain.com/same-article-but-in-english).

However, I get the following error on every page :

Notice : Undefined property: stdClass::$domain in locale_language_url_rewrite_url() (line 437 in /home/includes/locale.inc).

This corresponds to this bit of the locale.inc file:

if (isset($options['language'])) {
switch (variable_get('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX)) {
  case LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN:
    if ($options['language']->domain) {
      // Save the original base URL. If it contains a port, we need to
      // retain it below.
      if (!empty($options['base_url'])) {
        // The colon in the URL scheme messes up the port checking below.
        $normalized_base_url = str_replace(array('https://', 'http://'), '', $options['base_url']);
      }

This results in the module correctly changing the part of the URL following the domain, but not the domain itself (i.e. instead of being set to en.domain.com/same-article-but-in-english I get sent to fr.domain.com/same-article-but-in-english, remaining on my initial domain, thus leading to the anticipated 404 Error).

My (admittedly crude) understanding is that the variable corresponding to $options['language']->domain is not set? What gives and how can I change this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.