Domain Name language negotiation and mobile prefix m
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.