Option Explicit '=============================================================================== ' Copyright © 1998-2004 Beta-Sigma Data Systems, All Rights Reserved ' http://www.beta-sigma.com Sales@beta-sigma.com '=============================================================================== '============== ' SECTION 1. '============== ' Here we define a public instance of the Localization Guru ActiveX control ' so that when we refer to it throughout this project we can say gLG.GetS() ' rather than frmLocGuru.lgCtl.GetS(). ' Remember to intialize gLG in your Main() routine prior to loading the ' first translatable form of your application, e.g. Set gLG = frmLocGuru.lgCtl. Public gLG As LocGuruCtl '============== ' SECTION 2. '============== '---------------------------------------------------------------------------- ' This is where you define an enum value for each string constant that ' will be handled by the gLG.GetS() method. You do not need to include ' strings that appear on Forms or the Controls contained on Forms. ' For each enum value you store the actual string value in the LocGuruGetS() ' function. '---------------------------------------------------------------------------- Public Enum eLocGuruStringID eFirstStringElement = 0 ' Do not change this! '--------------------------------------------------- ' Keep this list in alphabetical order so that it ' can be searched quickly by a human programmer. '--------------------------------------------------- AppTitle_str AreYouSure_str Bear_str Cat_str Dog_str ExportStrings_str Feature0_str Feature1_str Feature2_str Feature3_str Feature4_str Feature5_str Feature6_str Feature7_str LocGuru_str LongString1_str LongString2_str NamesMustBeUnique0_str NamesMustBeUnique1_str NamesMustBeUnique_str OpenLangDB_str PleaseSeeCode_str String1_str String2_str Version_str '--------------------------------------------------- eLastTranslatedString ' Do not remove! '--------------------------------------------------- ' Any enum values defined after this point WILL NOT ' be exported into the Language database. '--------------------------------------------------- NotInLanguageDatabase_str '--------------------------------------------------- End Enum 'eLocGuruStringID' '============== ' SECTION 3. '============== Public Function LocGuruGetS(ByVal eStrID As eLocGuruStringID, _ ByVal lNumArgs As Long, sUnknownStrID As String) As String ' Return the application string specified by 'eStrID'. ' ' This function is supplied by the application to work with the ' gLG.GetS() method. 'lNumArgs' specifies how many vParm parameters ' were passed into gLG.GetS(). If 'eStrID' specifies an unknown ' value then this function will return 'sUnknownStringID'. ' ' You do not need to include strings that appear on Forms or the ' Controls contained on Forms. The only strings that need to be ' to the following Select Case statement are string constants that ' are used in the application's code. Dim sRtn As String ' This Select Case maps 'eStrID' to a specific application string ' which is assigned to 'sRtn'. Select Case eStrID '----------------------------------------------------------- ' Keep this list in alphabetical order by eLocGuruStringID ' so that it can be searched quickly by a human. '----------------------------------------------------------- Case AppTitle_str sRtn = "Localization Guru Sample Application" Case AreYouSure_str sRtn = "Are you sure?" Case Bear_str sRtn = "Bear" Case Cat_str sRtn = "Cat" Case Dog_str sRtn = "Dog" Case ExportStrings_str sRtn = "Export application strings to Language Database %s" _ & "{\r}{\r}Are you sure?" Case Feature0_str sRtn = "Localization Guru Advantages" Case Feature1_str sRtn = "Easy to use" Case Feature2_str sRtn = "Translation is fast" Case Feature3_str sRtn = "Multiple languages" Case Feature4_str sRtn = "Language Editor included" Case Feature5_str sRtn = "Source code" Case Feature6_str sRtn = "Online help" Case Feature7_str sRtn = "Code examples" Case LocGuru_str sRtn = "Localization Guru" Case LongString1_str ' Remember that the maximum length of a string in the Language ' database is 255. So, we have to handle this as two pieces. sRtn = "If you need to display a long chunk of text then you may" _ & " need to store it in LocGuruGets() in multiple sections so that" _ & " no section is longer than 255 characters.{\r}{\r}" Case LongString2_str ' Remember that the maximum length of a string in the Language ' database is 255. So, we have to handle this as two pieces. sRtn = "It is best to split the sections at a sentence boundary" _ & " so that when the translated sections are concatenated" _ & " by the application you will not have a language syntax" _ & " problem." Case NamesMustBeUnique0_str sRtn = "Names must be unique" Case NamesMustBeUnique1_str sRtn = "%s names must be unique" Case NamesMustBeUnique_str ' Here is a case where we handle a string that can have zero or ' one argument. Notice how each of the two strings that can be ' used here (i.e. NamesMustBeUnique0_str and NamesMustBeUnique1_str) ' are themselves given a place in this Select Case statement. ' This must be done so that these strings can be exported to ' a Language Database. If lNumArgs >= 1 Then sRtn = LocGuruGetS(NamesMustBeUnique1_str, lNumArgs, sUnknownStrID) Else sRtn = LocGuruGetS(NamesMustBeUnique0_str, lNumArgs, sUnknownStrID) End If Case NotInLanguageDatabase_str sRtn = "This string will not be exported to the Language Database" _ & " because its enum value is placed after eLastTranslatedString" _ & " in the eLocGuruStringID enum definition." Case OpenLangDB_str sRtn = "Open a Language Database" Case PleaseSeeCode_str sRtn = "Please see the code in %s for some examples of using" _ & " LocGuru.GetS() to handle application strings." Case String1_str sRtn = "This string has one argument (%s)" Case String2_str sRtn = "This string has two arguments (%s) and (%s)" Case Version_str sRtn = "Version:" Case Else sRtn = sUnknownStrID & CStr(eStrID) End Select 'eStrID' LocGuruGetS = sRtn ' Return string to caller. End Function 'LocGuruGetS'