I am trying to implement this code in order to have different files for downloading into the German, Spanish or English languages ββof the browser of my choice. The fact is that with my Spanish IE, I still get an English file.
<?php
if (is_home()) {
if (preg_match('/de-DE/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
include(TEMPLATEPATH . '/german-navbar.php' );
}
elseif (preg_match('/es-ES/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
include(TEMPLATEPATH . '/spanish-navbar.php' );
}
else {
include(TEMPLATEPATH . '/english-navbar.php' );
}
}
I used both HTTP_ACCEPT_LANGUAGE, and HTTP_USER_AGENT.
This is a site test, if someone wants to test it, with German or Spanish as the preferred language in the browser: http://paragraphe.org/janette/
I have my Firefox in English and it works well, but I canβt be sure that the code works in both Spanish and German cases.
I found a snippet in this SO thread , but at the moment I am a little lost.
Thanks so much for any input,
EDIT: The code works in Firefox (but not in IE).