%
'#################################################################################
'## Copyright (C) 2000-01 Michael Anderson and Pierre Gorissen
'##
'## This program is free software; you can redistribute it and/or
'## modify it under the terms of the GNU General Public License
'## as published by the Free Software Foundation; either version 2
'## of the License, or any later version.
'##
'## All copyright notices regarding Snitz Forums 2000
'## must remain intact in the scripts and in the outputted HTML
'## The "powered by" text/logo with a link back to
'## http://forum.snitz.com in the footer of the pages MUST
'## remain visible when the pages are viewed on the internet or intranet.
'##
'## This program is distributed in the hope that it will be useful,
'## but WITHOUT ANY WARRANTY; without even the implied warranty of
'## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
'## GNU General Public License for more details.
'##
'## You should have received a copy of the GNU General Public License
'## along with this program; if not, write to the Free Software
'## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
'##
'## Support can be obtained from support forums at:
'## http://forum.snitz.com
'##
'## Correspondence and Marketing Questions can be sent to:
'## reinhold@bigfoot.com
'##
'## or
'##
'## Snitz Communications
'## C/O: Michael Anderson
'## PO Box 200
'## Harpswell, ME 04079
'#################################################################################
' LANGUAGE RELATED FUNCTIONS
' For More Information Please Read the LangReadMe.txt file
call LangDebug("===== inc_language.asp")
' ===== FUNCTIONS CALLED FROM ASP FILES ======
' Function fLang(s: string)
' Returns the value of the variable it takes as a string of variable name. Used for simple cases.
' INPUT
' ==== s: String of language variable name ==== changed for IIS4 compatibility
' s: String (language variable)
' EXAMPLE
' === response.write fLang("strLangDefault00050") ==== changed for IIS4 compatibility
' response.write fLang(strLangDefault00050)
' NOTE : This function is defined for future extension capability
function fLang(s)
' fLang=eval(s) ' commented out for IIS 4 compatibility, all related function calls changed
fLang=s
end function
' Function fLangN(s: string, paramlist)
' Used for sentences which are mixed with variables from code. Parameters are parsed and inserted
' into the sentence. The places of insertion are defined in the value of the string as %sN% where N
' (1,2,3...) indicates the variable
' INPUT
' ==== s: String of language variable name ==== changed for IIS4 compatibility
' s: String (language variable)
' paramlist: String, Separeted list of variable values. The format is : "param1|param2|..."
' where | is used as separetor. ParamN is used to replace variable %sN%.
' EXAMPLE
' ==== response.write fLangN("strLangDefault00060", intNoOfRecords & "|" & intMaxRecords) ==== changed for IIS4 compatibility
' response.write fLangN(strLangDefault00060, intNoOfRecords & "|" & intMaxRecords)
'
function fLangN(s, paramlist)
DIM s1, strParamArr, N, i
' s=eval(s) ' commented out for IIS 4 compatibility, all related function calls changed
s1 = s
strParamArr = split(paramlist, "|")
N=ubound(strParamArr)
for i=0 to N
s1=replace(s1,"%s" & i+1 & "%",strParamArr(i))
next
fLangN=s1
end function
' ===== NEW FUNCTIONS FOR LANGUAGE MANAGEMENT ======
' function isEmtyNull : returns TRUE if the parameter is empty or null or null string
function isEmptyNull(x)
if (isEmpty (x)) or (isNull (x)) or (x="") then
isEmptyNull = true
else
isEmptyNull = false
end if
end function
' === INITIALIZATION AND LANGUAGE SUPPORT FUNCTIONS
' function LangFindIndex (strLangCode)
' Returns the index of the language code input in the language array
' Returns null if not found
function LangFindIndex (strLangCode)
DIM i, res
for i=0 to intLangIndexCount - 1
if strLangCode=arrLang(i,0) then
res = i
Exit For
end if
next
LangFindIndex = res
end function
' function LangAppliedCode
' Returns currently applicable language code, either the default or the preferred
function LangAppliedCode()
if not isEmptyNull(strLangPrefCode) then
strLangAppliedCode = strLangPrefCode
else
strLangAppliedCode = strLangDefaultCode
end if
intLangAppliedIndex = LangFindIndex (strLangAppliedCode)
strLangCharset = arrLang(intLangAppliedIndex,2)
strLangLCID = arrLang(intLangAppliedIndex,0)
LangAppliedCode = strLangAppliedCode
end function
' function LangDebug
' Outputs Language Related global settings for debugging purposes
function LangDebug(prmt)
if blnLangDebug then
response.write "
" & prmt
response.write "
" & "strLangDefaultCode" & " = " & strLangDefaultCode
response.write "
" & "intLangDefaultIndex" & " = " & intLangDefaultIndex
response.write "
" & "strLangPrefCode" & " = " & strLangPrefCode
response.write "
" & "intLangPrefIndex" & " = " & intLangPrefIndex
response.write "
" & "strLangAppliedCode" & " = " & strLangAppliedCode
response.write "
" & "LangAppliedCode()" & " = " & LangAppliedCode()
response.write "
" & "Lang Cookie" & " = " & Request.Cookies(strUniqueID & "Lang")
response.write "
" & "Cookie" & " = " & Request.Cookies
response.write "
" & "Form" & " = " & Request.Form
'response.write "
" & "" & " = " &
end if
end function
'=== HTML SUPPORT FUNCTIONS
' sub LangShowLanguageSelector
' displays a combo-box for language selection (without a form, includes related JS)
sub LangShowLanguageSelector(strStyle)
DIM i, intLangInx
if blnLangSupport then
' create support JavaScript Functions
response.write vbCrLf & "
"
response.write vbCrLf & " " & vbCrLf
' response.write "" & vbCrLf
end if
end sub
' sub LangShowLanguageSelectorForm
' displays a combo-box for language selection with a form, the combo box is the single element of it
sub LangShowLanguageSelectorForm(strStyle)
if blnLangSupport then
' do show the selector
response.write vbCrLf & "