Multi-language support--asp internationalization multi-language detailed scheme based on web system

Source: Internet
Author: User
Tags include lowercase mail pack resource acer
Web 1.ASP Section
A. Building language Packs
1. Create a "Language Pack" directory in each subsystem,
such as bbs--> language-->simplified
--->traditional
--->english
2 Establish language files for each ASP,JS,HTC, such as ACMBBStopic.asp.lang, Treeview.htc.lang,
Used to hold language global variables.
such as directory language\english\ ACMBBSShow.asp.lang
Public Const langrollway= "reverse Roll"
Public Const langinvailduser= "Invaild user"
Public Const langmailbox= "mail Box"
Public Const langsyssetup= "System Setup"
Public Const langacmbbs= "Acer BBS"
Public Const langbulltn= "Acer bulltin"
Public Const langpersnsetup= "personal setting"
Public Const langpublictools= ' public Tools '
such as directory language\ simplified \ ACMBBSShow.asp.lang
Public Const langrollway= "reverse scrolling"
Public Const langinvailduser= "illegal user"
Public Const langmailbox= "Mail Folder"
Public Const langsyssetup= "System Settings"
Public Const langacmbbs= "The Ming Acer internet Café"
Public Const langbulltn= "bulletin boards"
Public Const langpersnsetup= "Personal Settings"
Public Const langpublictools= "group Tools"
Language global variable naming rules;
Must be VBScript variable definition way public Const
Variable name: "Lang" + Message Descption

B. Set Global.asa
SUB Session_OnStart
session.codepage= "1252" ' 1252En ' 950 traditional ' 936 simplified
Session.Contents ("Language") = "Chinese" ' 中文版 ' traditional ' simplified
Session.Contents ("strcharset") = "Big5" ' iso-8859-1 ' Big5 ' gb2312
End Sub
C. Referencing a language pack
1. Establishment of bbs--> language-->script directory, includelang.vbs
2. In each ASP,JS,HTC head
<script language=vbscript runat= "Server" src= "./language/script/includelang.vbs" ></Script>
<% call Includelangfile ("AcmMainPageshow.asp.lang", Session.Contents ("Language"))%>
3. Use of Ideas
o Read the *.lang and other language package function getfilecontents into a variable,
o Executing in the server using the Execute method in VBScript
Includelang.vbs content is as follows

'//'*********************************************************
'//' purpose:open include file
'//' Inputs:strincludefile path
'//' Returns:all Text
'//'*********************************************************

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

'//'*********************************************************
'//' Purpose: Dynamic include file
'//' inputs:strincludefile path, language type
'//' Returns: Execute variable to global variable
'//'*********************************************************
Function Includelangfile (Strfilename,language)
On Error Resume Next
Dim Strlangpackagepath
Dim Strlanguagepath
Strlanguagepath=language
Strlangpackagepath= "./language/" & Strlanguagepath & "/" & strFileName
Execute (Getfilecontents (Strlangpackagepath))
IF ERR Then
Response.Write "Error Include this language package file<<" & Strincludefile & ">>! Check the file ' s syntax '
Response.End
End IF
End Function
2. Part of the picture
Establish bbs--> language-->simplified-->image for images with Chinese characters
--->traditional-->image
--->english-->image
Dynamic include



3.COM part
Using the resource File Control language version, the system automatically determines the language version

Note: Resource file Simplified Chinese code must be entered in the simplified machine, Traditional Chinese code must be entered in traditional machine


4. Other

Multi-language version reference rules:
1. The length of English translation is as long as the length of Chinese.
2. To conform to each version of the language habits.
3. In English, title, text label, button text,select option to capitalize the first letter of the English word, but
Prepositions, conjunctions, and articles use lowercase.
4. All abbreviations in the English version are capitalized.
5. The English version of Check, radio, English first letter capital.
6. The state information in the English version uses lowercase.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.