Share via


SA_GetLocString

Server Appliance Kit

This function returns the specified string from the resource DLL in the current language directory.

  
    SA_GetLocString(
ByVal 
    sourceFile
    ,
    
    ByVal
     resourceID
    ,
    
    ByRef
     replacementStrings
    
)
  

Parameters

  • sourceFile
    Name of the resource DLL that contains the strings.
  • resourceID
    Resource identifier of the desired string.
  • replacementStrings
    Array of strings to use as replacement strings.

Return Values

The localized string.

Remarks

By putting all UI text in resource DLLs, it is possible to create a multilingual server appliance with minimal effort.

The following Microsoft® Visual Basic®, Scripting Edition (VBScript) code example uses the SA_GetLocString function to get text from a resource DLL. This sample uses the strReplacementStrings parameter to insert text into the message string.

A complete example using this function can be found in the localization sample file, Localized.asp.

  Dim strSourceFile
Dim strResourceID
Dim strReplacementStrings(1)    'Declare an array of 2

'These strSourceFile and strResourceID values correspond to the string "Unexpected error %1 %2"
strSourceFile = "sampleloc.dll"
strResourceID = "C05000CD"
strReplacementStrings(0) = "Value1"
strReplacementStrings(1) = "Value2"
'The resulting text will be displayed as "Unexpected error Value1 Value2"
Response.write(SA_GetLocString(strSourceFile, strResourceID, strReplacementStrings))

Note that depending on how the string is used, it might be necessary to use SA_EscapeQuotes and Server.aspLEncode.

Use Server.aspLEncode if the string will be enclosed in double quotes.

  Response.Write("<td title=""" + Server.aspLEncode(SA_GetLocString(strSourceFile, strResourceID, strReplacementStrings))+ """ >")

If the string will be used in JavaScript, use SA_EscapeQuotes and enclose the string in single quotes.

  SA_DisplayErr('<%=SA_EscapeQuotes(SA_GetLocString(strSourceFile, strResourceID, strReplacementStrings))%>')

If the string is used in JavaScript that is passed to an HTML parameter, you will need to use both SA_EscapeQuotes and Server.aspLEncoder.

  Response.Write("<td onmouseover=""window.status='" + Server.aspLEncode(SA_EscapeQuotes(SA_GetLocString(strSourceFile, strResourceID, strReplacementStrings)))+ "'"" >")

Requirements

Runs on Versions Defined in Include Link to
Server (ASP), VBScript Microsoft Server Appliance Kit 3.0   inc_framework.asp  

Note

  • This function is part of the complete Server Appliance Kit as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM), and some devices might not support this function.