Using Language Assistant
Return to Introduction  Previous page  Next page
Language Assistant lets you update associated language DLLs and identifier library without leaving your application. It can also create the properly formatted LoadResString statement.

Language Assistant can be invoked in the following ways:

n From the "More VO Productivity Pack" menu option that appears on the Visual Objects Tools menu
n From the menu that appears when you left mouse click on the VOPP icon in the Windows system tray
n Press Ctrl-Alt-G while in the Visual Objects IDE

Before calling up Language Assistant you should highlight the text that you want to process - either the string literal or the language identifier constant. Language Assistant will read the highlighted text and place it it into its dialog.

The image below shows how the Language Assistant dialog appears when invoked while a string literal is highlighted. (If invoked while a string identifier is highlighted the dialog shows different buttons at the bottom.) A name for the string identifier is generated from the highlighted string - the prefix used can be controlled through VOPP Plus!.



The first time you use Language Assistant in an application you need to supply details such as the name of the library that will contain the string identifiers (Standard MDI Language Lib in the examples used earlier), and the handle (or name) to be used by LoadResString() (gpLanguage in the earlier example). For each language DLL you need to supply the appropriate string and the name of the DLL (in the earlier examples the DLLs were Standard MDI EN and Standard MDI DE. An example of a dialog that has been filled in is shown below:



Processing options
Once the necessary information has been completed you have a choice of how that information should be applied. If Language Assistant was invoked while a string literal was highlighted you have the following choices:

n Update and send load statement to VO editor
n Update and send default string to VO editor

If Language Assistant was invoked while a string identifier was highlighted you have one choice:

n Update and send string id to VO editor

Update
In each of these choices Update means the language DLLs and the language identifier library will be automatically modified using the values from the dialog. Each language DLL is updated with the string identifer and its particular string value. The string identifier is added to the language identifier library.

Send Load Statement
You will want to send the load statement to the VO editor if you do not yet have a LoadResString() call in your code. Here is a sample line of code that you might want to use Language Assistant on:

SELF:Caption := "Standard MDI Application"

In this example you would highlight the string literal:



and then call up Language Assistant. Because you do not yet have a LoadResString in your code you should choose the send load statement to VO editor option. This will update your source code to appear as follows:

SELF:Caption := LoadResString(/*"Standard MDI Application"*/,IDL_STANDARDMDIAPPLICATION,gpLanguage)

Note: The default string in this example has been commented out. Language Assistant does it that way to save some space in the application EXE, since the intention is that you should always supply a DLL with the necessary language strings. If you would rather not comment out the default string you can reconfigure Language Assistant's behaviour via VOPP Plus!. This commenting technique works in the source code and window editors but does not work in the menu editor.

Send Default String
You will want to send the default string to the VO editor if the string literal you used to invoke Language Assistant was already part of a LoadResString() call, such as if you had highlighted "Standard MDI Application" (including the quotes) in the following line of code:

SELF:Caption := LoadResString(/*"Standard MDI Application"*/,IDL_STANDARDMDIAPPLICATION,gpLanguage)

In this situation you just want to send back the default string (that you may change in the dialog) - you do not want Language Assistant generating another LoadResString() call.

Send String Id
You will want to send the string identifier to the VO editor if you had an existing string identifier highlighted when you invoked Language Assistant. An example of this is if you highlighted IDL_STANDARDMDIAPPLICATION in the following code:

SELF:Caption := LoadResString("Standard MDI Application",IDL_STANDARDMDIAPPLICATION,gpLanguage)

In this situation you just want to send back the string id (that you may change in the dialog).

Configuration information
Whenever an update button is pressed the configuration information from the dialog is automatically stored in a TEXTBLOCK entity called VOPP_Language_Options and by default is created in the first module of your application (you may move it after it has been created).:

TEXTBLOCK VOPP_Language_Options
/*
String Id Library: Standard MDI Language Lib
String DLL 1: Standard MDI EN
String DLL 2: Standard MDI DE
String DLL 3:
String DLL 4: 
LoadResString Handle: gpLanguage
*/

This entity is read on subsequent invocations of Language Assistant and used to fill in the fields on the dialog that is displayed.

New versus Existing
Whenever you call up Language Assistant it will attempt to find the appropriate entries in the language DLLs and automatically fill the dialog that is shown.

If you call up Language Assistant while a string literal is highlighted it attempts to find that string in the default language DLL. If it finds the string it then uses the associated string id to find the corresponding strings in the other language DLLs.

If you call up Language Assistant while a string id is highlighted it extracts the appropriate strings from each of the language DLLs.

If Language Assistant determines that the entry is new it shows a "New" image near the top of the dialog and adjusts the dialog caption. If the entry already exists it is reported as "found" in the dialog caption and no image is shown.

Window and Menu Editors
The Language Overview discussed how the Window and Menu editors require any LoadResString() calls to be entered using the characters < and >. Language Assistant automatically recognises when the Window/Menu editor is in use and adjusts its output accordingly. For these editors, the "send the load statement" option translates into sending a string such as:

<"&Open...",IDL_OPEN,gpLanguage>

Due to limitations in the VO develoment environment design, in the Menu editor can be quite difficualt to work with in conjunction with Language Assistant. The easist way to enter a new language string is to use the main menu editor window, not the Menu Item Properties pop up window.

However the only way to update an existing language string is to use the Menu Item Properties window. Unfortunately as soon as this window loses focus the data entry field is removed. So after you press the Update button in Language Assistant you need to go back to the property you were editing, click on it, highlight the same text again and then paste.

We are currently devising a new way to handle menu strings and details about it will be posted to http://www.piko.com.au
.


© Piko Computing Consultants, 1998-2002