I have updated the downloadable source code for my .NET Internationalization book. The Visual Studio 2012 source code is downloadable from here. In this update there are 5 new FxCop globalization rules:-
- Do not convert to uppercase - This rule catches all uses of ToUpper. It can be considered a more severe version of FxCop's own "Specify CultureInfo" rule. If the conversion to uppercase is used to perform a case insensitive comparison then String.Compare should be used instead. If the conversion to uppercase is used to change user data then it would be better not to convert the user data at all.
- Do not convert to lowercase - This rule catches all uses of ToLower. It serves the same purpose as the previous rule except that it catches ToLower instead of ToUpper.
- Boolean.ToString() is not localizable - This rule catches all uses of Boolean.ToString(). The words "True" and "False" are specific to English and are therefore not localizable. This rule is similar to the existing "Enum.ToString() is not localizable" rule.
- Identifiers should not be called FirstName - This rule catches fields and properties that are called FirstName (or a variation of FirstName). The term "first name" is a western naming convention and it does not accurately identify a name part (even in Europe some countries use Family Name / Given Name order). Use the term "Given Name" instead.
- Identifiers should not be called LastName - This rule catches fields and properties that are called LastName (or a variation of LastName). The term "last name" is a western naming convention and it does not accurately identify a name part. Use the term "Family Name" instead.
In total the downloadable source code now contains 25 FxCop globalization and localization rules.
Technorati Tags: FxCop