Gustaf,
In fact Apache does show errors related HTTP_ACCEPT_LANGUAGE
[Sun Jun 29 14:45:19 2014] [error] [client 208.115.111.66] PHP Notice: Undefined index: HTTP_ACCEPT_LANGUAGE in /var/www/natopia/app/Config/core.php on line 973
[Sun Jun 29 14:45:22 2014] [error] [client 208.115.111.66] PHP Notice: Undefined index: HTTP_ACCEPT_LANGUAGE in /var/www/natopia/app/Config/core.php on line 973
[Sun Jun 29 14:56:02 2014] [error] [client 66.249.65.232] PHP Notice: Undefined index: HTTP_ACCEPT_LANGUAGE in /var/www/natopia/app/Config/core.php on line 973
[Sun Jun 29 15:13:24 2014] [error] [client 66.249.65.219] PHP Notice: Undefined index: HTTP_ACCEPT_LANGUAGE in /var/www/natopia/app/Config/core.php on line 973
Moreover I installed php5-intl then I added a PHP call to set HTTP_ACCEPT_LANGUAGE accordingly (i.e. Locale::setDefault($lang);), within PHP website configuration files.
It seems to be working fine now. Apache doesn't return errors anymore. Plus, I wrote echo($_SERVER['HTTP_ACCEPT_LANGUAGE']);
to confirm that HTTP_ACCEPT_LANGUAGE is assigned properly.
You also can see its output at the very top left of page: http://dev.natopia.com/Retreats/details/luxury-eco-lodge-in-the-amazon-wildlife
I noticed that independently on what idiom I select HTTP_ACCEPT_LANGUAGE value doesn't change. (i.e. "en-US,en;q=0.5"). Its value permanently is "en-US" even if I change the language of the website.
Should I expected it to switch laguange when the website language is change to en, es or pt?
Furthermore, OACS page's still called only in en_US, even though the website is in pt-BR.
On another front, to set Accept-Language to the desired language within javascript code, I should add an AJAX chunk which is triggered by the link that calls the popup to show up. Thus, it would request http with headers properly set. As in.
var locale = escape(document.getElementById("locale").value);
xmlhttp.setRequestHeader("Accept-Language", locale);
But, unfortunately it didn't work out as expected.
function loadXMLDoc() {
var xmlhttp;
var locale = "pt-BR";
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xmlhttp.setRequestHeader("Accept-Language", locale);
xmlhttp.setRequestHeader("User-Agent", "XMLHttpRequest");
xmlhttp.open("POST","http://ecommerce.natopia.com/natopia/core/check-availability-confirmation",true);
xmlhttp.send();
}