Calling the Lingo Object

The process of building a set of localized HTML pages begins when the user clicks the option on the PT application's Build menu. The event handler for the ONCLICK event, which is associated with the Popup ActiveX control, calls Build.asp, which contains the following code:

Dim oLingo,srcPath,destPath,lingofile,rootPath,pos
'Debug: harcoded lingo file name
lingofile = "lingo.xml"
rootPath = Server.MapPath(".")
srcPath = rootpath & "\global"
destPath = Request.QueryString("langFolder")
If destPath =""  then
   'Debug Code: Hard Coded Value
    destPath = "en-us"
End If

destPath = rootPath & "\" & destPath

Set oLingo = Server.CreateObject("Litware.Lingo")

call oLingo.Build(srcPath,destPath,lingofile)

Set oLingo = Nothing

This code finds the global directory, which contains globalized XML template files and the folders for each language the application supports. The value for the langFolder parameter passed to Request.QueryString is set during the XSL transformation and exists in the HTML file resulting from the call to menu.asp, which builds the application menus. If the call to Request.QueryString returns an empty string, the application defaults to U.S. English (en_us).

Next, the code sets the destination path for the localized HTML files that result from the call to the Lingo.Build method. Then the code sets the reference to Litware.Lingo and calls Lingo.Build, passing as arguments the source directory that contains the globalized XML template files, the destination path for the HTML output of the build process, and the lingo.xml file used to populate the XML templates with localized strings.

The following code fragment contains the function prototype for the call to Lingo.Build:

Public Sub Build(
                    ByVal sSourcePath As String,
                    ByVal sDestination As String,
                    ByVal LingoFileName As String)

With the arguments passed from Build.asp, the Lingo object builds the requested HTML files. The build process uses the Win32® API to handle the file system. For more information, see Using the Win32 API for File Handling.