Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Internationalization (v4)
 const or not?
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

bjlt
Senior Member

1144 Posts

Posted - 07 October 2002 :  10:40:23  Show Profile
see related topic here:
http://forum.snitz.com/forum/topic.asp?TOPIC_ID=36223



test.asp

<%
if Trim(Request.QueryString("lan")) <> "" then
strUserLan = Lcase(Trim(Request.QueryString("lan")))
else 
strUserLan = "en"
end if
Execute(GetFileContents(strUserLan & ".asp")) 
%>
<a href="?lan=en">en</a>
<a href="?lan=jp">jp</a>

<%
response.write str1


Function GetFileContents(strIncludeFile)
On Error Resume Next 
Dim objFSO
Dim objText
Dim strPage 
Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 
Set objText = objFSO.OpenTextFile(Server.MapPath(strIncludeFile)) 
GetFileContents= objText.ReadAll
objText.Close
Set objText = Nothing
Set objFSO = Nothing
IF Err Then 
Response.Write "Error open this language package file<<" & strIncludeFile & ">>!"
Response.End
END IF 
End Function

%>



en.asp



Public const str1="english"


jp.asp


Public const str1="japanese"




I found on the web that public const is used here, what's the difference of const and variable here? and it seems that public const works, as one can change the value of it, should I declare it as a const?
what should be used here?

Thanks.
<

Edited by - bjlt on 07 October 2002 12:03:43

Deleted
deleted

4116 Posts

Posted - 07 October 2002 :  10:55:25  Show Profile
I'll test it tonight and comment here...<

Stop the WAR!
Go to Top of Page

bjlt
Senior Member

1144 Posts

Posted - 07 October 2002 :  13:33:25  Show Profile
ah, I just remembered that we need to use variables as we can't use dynamic include in IIS4.<
Go to Top of Page

Deleted
deleted

4116 Posts

Posted - 07 October 2002 :  17:25:07  Show Profile
I tried the following cases:

public const str1="xxx"
const str1="xxx"
str1="xxx"

All worked. This only will run on IIS 5+, because you are using the Execute statement, also FSO must exist. There shouldn't be any problems in multiuser environments, perhaps except performance.

I actually understand how & why it works, but I'm not sure how it is handled internaly. Using "const" will be most efficient method generally, but I think (but not sure) this time IIS will not use its performance because it will re-compile the pages on every hit.
<

Stop the WAR!
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.17 seconds. Powered By: Snitz Forums 2000 Version 3.4.07