String Disqualification Process  Previous topicNext topicFirst topicLast topic



String Disqualification Process

Overview
All the unique strings in a Visual Basic Project are divided into two groups: those being moved to the Resource file and those that will be ignored. All processing is done on a string basis rather than on a context basis. Strings are disqualified from the Resource file both on the content of the string itself or on the string's usage. If there is a string is used in multiple instances and some instances have been selected for transfer to the Resource file, you can still eliminate all occurrences of this string from the Resource file. There are also Built-In string processing procedures that cannot be disabled but they can be overridden by a 'DO NOT LOCALIZE disqualifier.

How String Disqualification Works
Strings are automatically selected for the Resource file or disqualified from the Resource file based on a fairly complex hierarchy of tests. Most of the tests have to do with disqualifying a string from the Resource file. The tests are listed in the order of precedence:

1. All strings that are used in programmatic ways that are unsuitable for Resource files are disqualified. This type of string would probably break your code if they were moved to a Resource file, so they are arrested early on. It is not possible to override these disqualifications.

2. An explicit 'DO NOT LOCALIZE' or an explicit 'ALWAYS LOCALIZE' in the comment section of a line of code will ensure that all strings in this line of code will either be prevented or forced into the Resource file. These comments tags can be automatically appended for you as you change the status of strings.

3. Some additional testing is done at this stage to automatically disqualify strings that probably don't belong in the Resource file but might occasionally be desirable to be in the Resource file. Any strings having to do with Dir, MkDir, ChDir, Instr, and the "#,###" string in Format(sMyString, "#,###") are disqualified. But it is possible to override these disqualifications.

4. Obvious user interface strings that are being assigned to properties like .Caption, .ToolTipText, and .Title are selected for transfer to the Resource file at this point. If a string is being assigned to one of these properties, no further testing will take place but it is possible to manually override these selections.

5. Optional disqualification of the string itself is done at this stage. Strings like "ALL_CAPITALS", "OddMultipleCapitalizations", "property.things.like.this" and any string with fewer than 2 letters (i.e. alpha-characters) are disqualified but it is possible to manually override these selections or any of the remaining tests that follow. The ALL_CAPITALS option also includes a variety of common SQL commands that usually are not suitable for Resource files.

6. The next test has to do with the string assignment disqualifications (DQs). A string assignment is whatever is to the left of the string in the line of code. There are four different cases for string assignments.

CASE 1
If the string assignment has a period '.' in front, as in '.FontName = ', then any strings that follow will be disqualified. The '.' period triggers a special comparison test that permits the assignment to fall anywhere to the left of the string, as if it were a * wildcard. For this reason, be sure to make any custom assignment DQs as explicit as possible to avoid the unintentional disqualification of a broad array of strings.

CASE 2
If the string assignment has a '*' wildcard '.' in the front or back, as in 'GetWindow*', then any strings that follow this will be disqualified. The '*' wildcard triggers a special comparison test that permits the assignment to fall anywhere to the left of the string. Be careful not to make these types of DQ assignments too short or too general in order to avoid the unintentional disqualification of a broad array of strings. NOTE: It is not possible to have embedded '*' wildcards. The DQ assignment 'Font*Things' will not work as a wildcard.

CASE 3
If an assignment DQ has no leading '*' or leading '.' or trailing '*', then the DQ assignment phrase is treated as a function call. For example, if the assignment DQ was 'UCase', then only these exact conditions would be disqualified:

UCase "String"
Ucase$ "String
var = UCase("String")
var = UCase$("String"
var = Get(UCase("String")
var = Get(UCase$("String")

But these would not cause a disqualification:

MyUCase "String"
var = MyUCase("String")


7. The last DQ test disqualifies all the strings in a line of code if the phrase is found anywhere in the line of code. This disqualification normally pertains to the comment section of the line of code but remember that this phrase will DQ the entire line if it occurs ANYWHERE in the line of code. This test is also case-insensitive, so use great care in specifying phrases in the entire line DQ section.