Auto-Insertion of VBLM On/Off Directives

A very good way to get VBLM to extract from your projects only those strings that should be translated is to insert commented directives into your source code that tell VBLM what and what not to extract (this is a good method because it is permanent yet reversible, and self-documenting). You can always add these directives yourself, but as of V6, VBLM can also do it for you.

Note: The one major limitation of directive comments -- and it is a big one -- is that you can't use them to exclude the string properties of controls set at design-time and stored in the definition section of control containers. This is because VB does not preserve any comments other than its own when it writes the definition section of these files. Thus when a string instance of this type is selected, the Exclude via Source Comment menu entries are disabled.

Step 1: Mark the Strings

Step 1 is to tell VBLM which currently extracted strings you would like excluded in this way. There are two ways to do this; one using the LTE, the other using the code window. Both require that the LTE be open with a language table (any language table) loaded.

The LTE method is to mark the strings one at a time, using either the edit menu or the popup menu. To use the edit menu, first select the string you want excluded by clicking on it, then select Exclude String via Source Comment (shortcut = Ctrl+S). To use the popup menu, right-click the string and make the same selection. The popup menu is slightly faster because you don't need to preselect the string. In both cases, the menus work like a toggle, ie if the string is already marked for exclusion, selecting it again unmarks it. Note also that if you mark a multi-instance string in the LTE, it applies to all instances; if you want to mark some but not all instances of the string, open the multi-instance editor and mark or unmark individual instances.

The code window technique allows you to mark multiple strings simultaneously, as long as they are contiguous. To use it, in the code window highlight the code containing the strings, then right-click it and select Exclude/Mark for Exclusion in Source File on the popup menu.

Note: Although you can always highlight only part of a line (eg, one string in a line with more than one string), the code window technique can't resolve anything finer than a single line. This means that selecting any part of a line will cause VBLM to add a directive that excludes ALL strings on the line. The LTE method does not have this limitation -- when a string is excluded with the LTE method, only the string selected will be marked for exclusion.

Step 2: Auto-Insertion

Whenever you close the LTE, VBLM checks to see if you have marked any strings for exclusion via directive comments and if so, presents a dialog:

image\DIRECTIVE_DIALOG.gif

If you select Yes, VBLM will rewrite the relevant source files, inserting the directive comments needed to exclude the selected strings. The original files, however, will not be overwritten; instead, they will be renamed with unique numeric extensions. If MyForm.frm is rewritten for example, VBLM will first test for the existence of MyForm.001. If MyForm.001 doesn't exist, MyForm.frm will be renamed as MyForm.001. If MyForm.001 does exist, VBLM will test for the existence of MyForm.002, and so forth.

If you select No, VBLM will unmark the strings for exclusion-via-source-code-comments.

If you select Cancel, the LTE will not close.

See Also

Comparing Exclusion Methods

Excluding Strings with a List File

Marking Strings as Excluded