javascript - Get the Windows User Language Settings Value -
is there way know client machines language settings? list separator (delimiter) selected. because, in project website (developed using php, javascript, jquery) client can export reports in csv format. @ present creating csv "comma" delimiter. of our clients , when open csv datas showing in 1 column comma separated.
i understood because default list separator selected in os control panel configuration may different delimiter comma. however, don't want tell every client change os configuration.. is there other solution this? if generate xls file instead of csv same issue come in future right???
try function
function getuserlanguage() { $langs = array(); if (isset($_server['http_accept_language'])) { // break string pieces (languages , q factors) preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_server['http_accept_language'], $lang_parse); if (count($lang_parse[1])) { // create list â??enâ?? => 0.8 $langs = array_combine($lang_parse[1], $lang_parse[4]); // set default 1 without q factor foreach ($langs $lang => $val) { if ($val === '') $langs[$lang] = 1; } // sort list based on value arsort($langs, sort_numeric); } } //extract important (first) foreach ($langs $lang => $val) { break; } //if complex language simplify if (stristr($lang,"-")) {$tmp = explode("-",$lang); $lang = $tmp[0]; } return $lang; }
Comments
Post a Comment