Domain Name language negotiation and mobile prefix m I have a question regarding the domain name language negotiation.

I have 3 languages and the following domains:


de.domain.com 
en.domain.com
fr.domain.com


When I set this as the domains for each language and use the domain name language negotiation everything works as expected.

My problem is that I have an adaptive mobile theme and I have to use following domains for that:


m.de.domain.com
m.en.domain.com
m.fr.domain.com


How can I achieve that those urls point to the correct language (de, en, fr). Now, all point to the default language (de).

Any help?
Take a look at the Language Negotiation API, specifically hook_language_negotiation_info_alter.  With this hook, you can replace the default URL based language negotiation callback function with one that respects the m. prefix.

Something like this should get you started.

function mymodule_language_negotiation_info_alter(&amp;$negotiation_info) {
  // Replace the core function with our own function.
  module_load_include('language', 'inc', 'language.negotiation');
  $negotiation_info[LANGUAGE_NEGOTIATION_URL]['callbacks']['language'] = 'mymodule_from_url';
  $negotiation_info[LANGUAGE_NEGOTIATION_URL]['file'] = drupal_get_path('module', 'mymodule') . '/mymodule.module';
}

function mymodule_from_url($languages) {
    // Your version of locale_language_from_url() that ignores the m. prefix.
}


For reference, the core function that handles language negotiation based on URL is locale_language_from_url.