User's Guide

Configuring Locale-Sensitive Methods

Globalyzer can scan source code files to locate locale-sensitive methods. For more information on locale-sensitive methods, click here.

Locale-sensitive methods are organized into groups, as shown below for a java rule set. New groups may be created. If the group is local to the Rule Set, it can be enabled/disabled, deleted, and modified. Enabling/disabling groups enables/disables all the local methods within the group. Only enabled methods are scanned for within source files.

The Inherited column lists the name of the Rule Set that defined the group. A value of 'No' indicates that the group is local to the Rule Set. Local groups can be modified and/or deleted. Inherited groups can be overridden by creating a new group with the same group name.

To disable a local group, uncheck the box.

To create a new group, select New Locale-Sensitive Method Group at the top of the page. This displays the Create Locale-Sensitive Method Group form, shown below.

The page contains three fields used to describe a group: Name, Description, and Enabled.

Use the Name field to give your group a brief, meaningful name.

Use the Description field to describe the group.

The Enabled field determines whether the methods within the group are processed by Globalyzer (checked) or ignored by Globalyzer for now (unchecked).

Once you've provided the group information, click the Create button. The Edit Locale-Sensitive Method Groups list redisplays, showing your changes.

You can only modify or delete a local group. Click on its name hyperlink from the Edit Locale-Sensitive Method Groups list. This displays the Edit Locale-Sensitive Methods list, shown below. Select either Edit Group or Delete Group at the bottom of the page. Note, if the group is inherited, the Edit Group button and the Delete group button will not be available.

Selecting Edit Group displays the page shown below.

All fields are modifiable. Press Update to save any changes. After editing or deleting a group, the Edit Locale-Sensitive Method Groups list redisplays, showing your changes.

Selecting the group Collation from the Edit Locale-Sensitive Method Groups list displays all the methods within the Collation group, as shown below. From here, methods can be enabled/disabled (if local), new methods can be added, and existing method information can be modified (if local).

The Inherited column lists the name of the Rule Set that defined the locale-sensitive method. A value of 'No' indicates that the method is local to the Rule Set. Local methods can be modified and/or deleted. Inherited methods can be overridden.

To disable a local method, uncheck the box.

To understand why a method is considered "locale-sensitive" in an internalized application, and what you'll need to do to ensure that it is being called properly, click on the help link for the method. Globalyzer displays custom i18n help. For example, here is an excerpt from the help for Java's String.toUpperCase() method:

To create a new method, select the New Locale-Sensitive Method link at the top of the page. This displays the Create Locale-Sensitive Method form, shown below.

The page contains six fields (eight fields if the language of the rule set is Java) used to describe a method: Name, Pattern, Class or Variable Type if Java, Parameter Type(s) to Filter if Java, Priority, Description, Help Page, and Enabled.

Use the Name field to give your method a brief, meaningful name.

The Pattern field must contain a valid Regular Expression. For more information on Regular Expression syntax, click here.

The Class or Variable Type field is currently available for Java Rule Sets only. This field may contain a fully qualified Class or Variable Type. It allows you to associate a Class/Type with the method name so detection will only take place when the method is called via the specified Class/Type.
Let's say you want to detect getInstance method calls but only for the Java Collator class. You would configure:

     Pattern: getInstance
     Class or Variable Type: java.text.Collator

Below indicates what happens when the following code is scanned:

     Collator cole = new Collator(...);
     Calendar cal = new Calendar(...);

     cole.getInstance(); // detected
     cal.getInstance();  // not detected because cal is not of type java.text.Collator

If the Class or Variable Type field is left blank, then all getInstance method calls will be detected.

The Parameter Type(s) to Filter field is currently available for Java Rule Sets only. This field is a comma-separated list of fully qualified Parameter Types. If one of these configured Parameter Types is being passed in the method call, the method will not be detected. For example, if you want to detect getInstance method calls, but only if a Locale is not passed in, you would configure:

     Pattern: getInstance
     Parameter Type(s) to Filter: java.util.Locale

Below indicates what happens when the following code is scanned:

     Collator cole = new Collator(...);
     Calendar cal = new Calendar(...);
     Locale loc = new Locale(...);

     cal.getInstance(loc);  // not detected because Locale is passed in
     cal.getInstance();     // detected
     cole.getInstance(loc); // not detected because Locale is passed in
     cole.getInstance();    // detected

If you want to detect getInstance method calls, but only if called via the Collator class and only if a Locale is not passed in, you would configure:

     Pattern: getInstance
     Class or Variable Type: java.text.Collator
     Parameter Type(s) to Filter: java.util.Locale

Below indicates what happens when the following code is scanned:

     Collator cole = new Collator(...);
     Calendar cal = new Calendar(...);
     Locale loc = new Locale(...);

     cal.getInstance(loc);  // not detected because not called via Collator type
     cal.getInstance();     // not detected because not called via Collator type
     cole.getInstance(loc); // not detected because Locale is passed in
     cole.getInstance();    // detected

If the Parameter Type(s) to Filter field is left blank, then no filtering on the detection will take place.

The Priority field is used to rank the detected issue. Priorities range between 0 and 5. Assign priority 0 if the locale-sensitive method performs a string concatenation; for example, append() and concat() methods. Otherwise, assign priority 1 to 5, with 1 being the most likely to be an issue. Note that the string concatenation priority 0 will display as a 'C' in the Globalyzer Workbench.

Use the Description field to (1) enter a more indepth explanation of the method, (2) understand the reason for its inclusion in the scan, and/or (3) describe a process to correct the problem.

Use the Category field to set a category that can be enabled or disabled in bulk for a ruleset.

The Help Page field is where you can provide a URL link for the method. This link may either help explain why this method is important, or it may explain how to correct the issue found.

The Enabled field determines whether the method is processed by Globalyzer (checked) or ignored by Globalyzer for now (unchecked).

Once you've provided the method information, click the Create button. The Edit Locale-Sensitive Methods list redisplays, showing your changes.

If a locale-sensitive method is local to the Rule Set, it can be modified and/or deleted. Click on its name hyperlink from the Edit Locale-Sensitive Methods list. This displays the Edit Locale-Sensitive Method page, shown below. All fields are modifiable. Press Update to save any changes. Press Delete to delete the locale-sensitive method. After updating or deleting, the Edit Locale-Sensitive Methods list redisplays, showing your changes.

If a locale-sensitive method is inherited, it can be overridden. Maybe you want to disable the inherited method in your Rule Set. Click on its name hyperlink from the Edit Locale-Sensitive Methods list. This displays the Override Locale-Sensitive Method page, shown below. All fields are modifiable, but if you change the pattern field, you will end up creating an entirely new locale-sensitive method, rather than overriding the inherited one. Press Create to create the override locale-sensitive method. After creating, the Edit Locale-Sensitive Methods list redisplays, showing your local locale-sensitive method.

To return to the list of groups for this rule set, select the Back to Groups link. To return to the Customize Rule Set page, select the Back to Summary link.

 Configuring Rule Sets