DF_Language

Last update 7-apr-05

Info2000 web site: www.info2000.biz

Overview to DF_Language

DF_Language is set of dlls written under Visual Basic 6.0 SP5 that allows you to create multilanguage software in an easy way.

Components

DF_Language is composed by following pieces:

Pieces

 
DF_Language.dll This library contains all logic required for capturing your project, preparing the language file (.lan) and returning at your software runtime, translated strings. This .dll must deployed within your installation package, as well with .lan files
DF_Language_AddIn.dll This is the add-In for Visual Basic that parse your project and creates the language file (.lan)
Language Manager Is an editor for .lan files, that allows you or anybody else, to modify and create new languages
.Lan This is a binary file that contains all references to your project, as well compiled and must be deployed within your installation package

 

Creating Multilanguage software

Before proceeding you have create a backup of your entire Visual Basic project: DF_Language will modify part of your source code!

Open your Visual Basic project, jump to menu "Add-Ins" and select DF_Language. If DF_Language is not visible you may activate it by clicking on Add-in Manager and double clicking on DF_Language.

Once you click, an interface should appear: typically you don't need to modify default values but it's better if get a look to the options.

It's pretty important the "Project Name", since this is the unique key used later on for calling translations: be sure to use a different project name for each project you're going to put into same .lan file. Please note, .lan file can contain language dictionary for more than one project so, once again, it's vital to maintain an unique ID (name) for each project; i.e.: your project can be complex and made by interfaces, user control, dlls and so on.

Back to the add-in main interface, you should now type the language used for original text hardcoded into your project: that means the language you used originally for writing your software.

Now you may click on "Process project" and wait all parsing ends: time required is also proportional to size of your project.

Right at this time your lan file has been created and you should edit the language file for adding new languages than original included into your project: for doing that use Language Manager

Once you are ready for deploying don't forget to include: DF_Language.dll and .lan file(s)

Please note your source code now received automatically a new .bas file named "DF_Language_shared.bas", you have to reference your project to DF_Language.dll to and you have to add manually at least following code:

Code code to be added

First row to be executed by your software DF_Language_InitialSetup App.Path & "\" & App.EXEName & ".lan" where: App.Path & "\" & App.EXEName & ".lan" is the path of .lan file reachable at run time from your software.
Form_load MyDF_Language.TranslateComponent "YourProjectName", Me This line translates objects into your form or whatever container

once into your software as first row to be executed a line like that: DF_Language_InitialSetup App.Path & "\" & App.EXEName & ".lan" where: App.Path & "\" & App.EXEName & ".lan" is the path of .lan file reachable at run time from your software.

Objects info

Add-in options

What to process Here appears all components of selected Visual Basic project. You may select to include all your projects or just s subpart or him
What to exclude (instr) If parsing your source code any of words are listed into this list box is found, DF_Language will ignore this row
What to exclude (separated) If parsing your source code all words per list box item are listed, DF_Language will ignore this row. I.e.: "And%Like" means that if into one single source code row are present at same time the two words "and" and "like", doesn't matter the case, this row will be ignored. Please note you may add your custom conditions here by using "&" as separator.

DF_Language (class main)

get_LanguageInUse() As String Returns current language used during current DF_Language session
load_LanguageFile (ByVal LanguageFileName As String) Used for load into memory .lan file with all translations available
set_Language (ByVal LanguageToUse As String) Set language to be used for translation for  current DF_Language session. You should set it once but you can modify each time you wish.
Translate (ByVal Index As String, Optional ByVal LanguageToUse As String) As String Used only for source code, it returns a string that represents the translation based on language selected. If no language is passed, language used should be the one passed via set_Language. If language is passed it will not overwrite the previous value already passed via set_Language
TranslateComponent (ByVal ProjectName As String, ByVal FormToTranslate As Object, Optional ByVal LanguageToUse As String) Used internally for translating all objects into your forms or generic component
Version()  as String Returns version of DF_Language; used also for licensing e numbering DF_Language suite
   

 

Distribution

DF_Language.dll is royalty free, you may include only DF_Language.dll. Lan files generated by DF_Language are your property.