Here is what i have done. Not sure if it helps you. I can't add comments. So here you go. This is based on geo plugin
Plugin serviceclass:
//to get local ele
private function getLocalElement()
{
$source=craft()->request->getRequestUri();
if($source==''){
$source = 'home';
}
return craft()->elements->getElementByUri($source);
}
//finds locale and redirect
private function redirectToLang()
{
$value=$this->detectBrowserLang()."_".strtolower($this->detectCountryCode());
if(in_array($value, craft()->i18n->siteLocaleIds)==1){
$element=$this->getLocalElement();
if(!is_null($element)){
$localElementUri = craft()->elements->getElementUriForLocale($element->id, $value);
header('Location: '.$this->configBaseUrl().'/'.$value.'/'.$localElementUri, true, 302);
}
}
}
//browser lang
private function detectBrowserLang()
{
$browserLang=craft()->request->getBrowserLanguages();
if(isset($browserLang)){
$lang=substr(strtolower($browserLang[0]),0,2);
return $lang;
}
}
//detect country code by geo
private function detectCountryCode()
{
$info=$this->getInfoGeo();
$countryCode=strtoupper($info["country_code"]);
return $countryCode;
}
Basically checking browser lang and country code(geo) with craft locales.