Enhance language detection done by the Request.Language property.

[GB.WEB]
* NEW: Enhance language detection done by the Request.Language property.
This commit is contained in:
gambas 2019-06-21 20:00:58 +02:00
parent 64a13bfab4
commit 0179eb5936

View file

@ -232,14 +232,17 @@ Private Function Language_Read() As String
Dim aLang As String[]
Dim sLang As String
Dim iPos As Integer
Dim I As Integer
aLang = Split(CGI["HTTP_ACCEPT_LANGUAGE"], ",")
If aLang.Count = 0 Then Return System.Language
sLang = aLang[0]
iPos = InStr(sLang, ";")
If iPos Then sLang = Left(sLang, iPos - 1)
sLang = Replace(sLang, "-", "_")
Return sLang & ".UTF-8"
For I = 0 To aLang.Max
iPos = InStr(sLang, ";")
If iPos Then sLang = Left(sLang, iPos - 1)
If InStr(sLang, "-") Then Return Replace(sLang, "-", "_") & ".UTF-8"
Next
Return System.Language
End