Sun Java Solaris Communities My SDN Account Join SDN

Article

8-Bit Clean Source Code Testing for I18N

 
 

You can find certain I18N problems by analyzing a product's source code. This section contains tests that you can either run as part of the build environment or run separately.


The tests identify and flag possible coding problems related to I18N issues. You can direct the output of the tests to a file for analysis.

Not all flagged lines contain errors. The tests cannot always tell whether or not the lines represent text that is meant for users to see. This is why you must analyze the test results. Patterns on certain lines can be filtered out if post-processing is desired.

The tests can be extended to cover whatever is needed. For instance, the information and scripts shown below were written for analyzing C and C++ programs. To test a product written in the Java programming language, use the scripts as templates and insert language-specific requirements as needed.

What the Test Checks


The code should not contain the following items:

  • numbers that violate 8-bit clean rules that may affect the output
  • use of the word "ascii"
    This is to ensure that character ranges hard-coded to an ASCII range can be flagged.
  • hard-coded money symbols, such as dollar, pound, or yen signs used with numbers
  • use of /ctime|asctime|localtime|gmtime/
    There are internationalized versions of these calls.
  • use of str[n]cmp
    There are internationalized versions of these calls.
  • use of a XmStringCreate that does not use XmStringCreateLocalized
The test also:
  • ensures that XmSTRING_DEFAULT_CHARSET is used when strings are created.
  • checks for lines that hard-code a range comparison instead of using the ctype.h functions.

The test skips commented lines in C and C++ programs.


Samples and Scripts


NOTE: Please remember that these are sample scripts and tools that may need customization for your product's syntax, naming conventions, and file locations.

Back to Top

Rate and Review
Tell us what you think of the content of this page.
Excellent   Good   Fair   Poor  
Comments:
Your email address (no reply is possible without an address):
Sun Privacy Policy

Note: We are not able to respond to all submitted comments.