JM
06-03-2002, 16:41
Ova skripta radi redirect na folder onog jezika koji je definiran u browseru.
To znaci da se na index stranicu postavi
<%@LANGUAGE="VBSCRIPT"%>
<!--#include virtual="/langrdr.inc"-->
i onda ako se dolazi npr iz njemacke vodi browser na ime.com/de kojeg sama odredjuje
Trebalo bi dodat ili izmjenti nesto da ako jezik nije definiran vodi na osnovni jezik npr engleski.
to bi bilo kao i google.com
skripta se snimi kao langdir.inc
<%
Dim strURL,strACCEPT
strACCEPT = GetAcceptLanguage()
' change the language code below to customize the default
If strACCEPT <> "en-us" Then
strURL = "http://" & Request.ServerVariables("HTTP_HOST")
strURL = strURL & "/" & strACCEPT & "/"
Response.Redirect strURL
End If
' this function returns the first accept-language
Function GetAcceptLanguage()
Dim strHTTP, strLANG, strTEMP, intTEMP
strHTTP = LCase(Request.ServerVariables("ALL_RAW"))
If InStr(strHTTP,"accept-language:") Then
strHTTP = Trim(Mid(strHTTP,16+InStr(strHTTP,"accept-language:")))
For intTEMP = 1 to Len(strHTTP)
strTEMP = Mid(strHTTP,intTEMP,1)
If IsAlpha(strTEMP) Or strTEMP = "-" Then
strLANG = strLANG & strTEMP
Else
GetAcceptLanguage = strLANG
Exit Function
End If
Next
End If
End Function
' determine if the character passed is a letter
Function IsAlpha(strCHAR)
If (Asc(strCHAR)>=65 And Asc(strCHAR)<=90) Or _
(Asc(strCHAR)>=97 And Asc(strCHAR)<=122) Then
IsAlpha = -1
Else
IsAlpha = 0
End If
End Function
%>
To znaci da se na index stranicu postavi
<%@LANGUAGE="VBSCRIPT"%>
<!--#include virtual="/langrdr.inc"-->
i onda ako se dolazi npr iz njemacke vodi browser na ime.com/de kojeg sama odredjuje
Trebalo bi dodat ili izmjenti nesto da ako jezik nije definiran vodi na osnovni jezik npr engleski.
to bi bilo kao i google.com
skripta se snimi kao langdir.inc
<%
Dim strURL,strACCEPT
strACCEPT = GetAcceptLanguage()
' change the language code below to customize the default
If strACCEPT <> "en-us" Then
strURL = "http://" & Request.ServerVariables("HTTP_HOST")
strURL = strURL & "/" & strACCEPT & "/"
Response.Redirect strURL
End If
' this function returns the first accept-language
Function GetAcceptLanguage()
Dim strHTTP, strLANG, strTEMP, intTEMP
strHTTP = LCase(Request.ServerVariables("ALL_RAW"))
If InStr(strHTTP,"accept-language:") Then
strHTTP = Trim(Mid(strHTTP,16+InStr(strHTTP,"accept-language:")))
For intTEMP = 1 to Len(strHTTP)
strTEMP = Mid(strHTTP,intTEMP,1)
If IsAlpha(strTEMP) Or strTEMP = "-" Then
strLANG = strLANG & strTEMP
Else
GetAcceptLanguage = strLANG
Exit Function
End If
Next
End If
End Function
' determine if the character passed is a letter
Function IsAlpha(strCHAR)
If (Asc(strCHAR)>=65 And Asc(strCHAR)<=90) Or _
(Asc(strCHAR)>=97 And Asc(strCHAR)<=122) Then
IsAlpha = -1
Else
IsAlpha = 0
End If
End Function
%>