From: Steven Barth Date: Fri, 30 Jan 2009 15:29:53 +0000 (+0000) Subject: Fix autodetection for extended language identifiers X-Git-Tag: 0.8.5~14 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=6c83242d9d52eac636988cedd7ef5d8c69d54017;p=oweals%2Fluci.git Fix autodetection for extended language identifiers --- diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index 24ce246df..5110209aa 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -134,7 +134,8 @@ function dispatch(request) local lang = conf.main.lang if lang == "auto" then local aclang = http.getenv("HTTP_ACCEPT_LANGUAGE") or "" - for lpat in aclang:gmatch("[%w]+") do + for lpat in aclang:gmatch("[%w-]+") do + lpat = lpat and lpat:gsub("-", "_") if conf.languages[lpat] then lang = lpat break