- /* Is the langage in the list ? */
- $found = false;
- foreach ($languages_list as $key => $v) {
- if (strcmp($l, $key) == 0) {
- $found = true;
+function t_parse_accept_language() {
+ if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
+ return [];
+ }
+ // Example: fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5
+ $langs = [];
+ $cols = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
+ foreach ($cols as $i => $semicols) {
+ $lang = explode(';', $semicols);
+ if (count($lang) === 0) {
+ continue;