Multi-language version is a headache ~ This problem has been mentioned many times. It is simple in principle and requires too much coding.
Simple-> traditional conversion is easier, but the general method of multi-country conversion is as follows:
There must be a language pack and a few copies of the database content,
The Language Pack can use xml and UTF-8 encoding. Of course, the inc file can also be dynamically included, but there is no xml clearance logic.
Localization time and currency. You can use the SetLocale (lcid) function provided by vbs)
Obtain the http header to obtain the browser language and call different language packs.
Xml is used as the language pack.
In fact, it is quite simple, but there are many nodes in the actual code. Here is just an idea. The sample code is as follows:
<? Xml version = "1.0" encoding = "UTF-8"?>
<Lang>
<Ch>
<Username> User Name </username>
<Password> password </password>
<BtnSubmit> submit </btnSubmit>
<BtnReset> Reset </btnReset>
</Ch>
<En>
<Username> username </username>
<Password> password </password>
<BtnSubmit> submit </btnSubmit>
<BtnReset> reset </btnReset>
</En>
</Lang>
-----------------------------
Test. asp
-----------------------------
<%
Function lang (langType, nodeName)
Set xmlDoc = Server. CreateObject ("microsoft. xmldom ")
XmlDoc. load (server. mappath ("lang. xml "))
Langdeskxmldoc.doc umentElement. selectSingleNode ("//" & langType & "/" & nodeName). text
End function
If request ("lang") = "ch" then langType = "ch" else langType = "en"
%>
<A href = 'javascript: location. href = "? Lang = <% if _ fcksavedurl = ""? Lang = <% if "langType =" ch "then response. Write" en "else response. Write" ch "%>" '> language change </a>
<Table width = "50%" border = "0" cellspacing = "0" cellpadding = "0" align = 'center'>
<Tr>
<Td> <% = lang (langType, "username") %> </td>
<Td> <input type = "text" name = "textfield"/> </td>
</Tr>
<Tr>
<Td> <% = lang (langType, "password") %> </td>
<Td> <input type = "text" name = "textfield"/> </td>
</Tr>
<Tr align = "center" valign = "middle">
<Td> <input type = "submit" name = "Submit" value = "<% = lang (langType," btnSubmit ") %>"/> </td>
<Td> <input type = "reset" name = "Submit" value = "<% = lang (langType," btnReset ") %>"/> </td>
</Tr>
</Table>
In actual coding, there will be more code. The first is to make the program more robust, and the second is to reuse the Code better, so there will be more code, the above is just an example.