How we change what others think, feel, believe and do

| Menu | Quick | Books | Share | Search | Settings |

C Style: Standards and Guidelines (contents)

CHAPTER 10 : Programming Usage


CHAPTER 10 : Programming Usage
10.1 Elegant programming
10.2 Performance programming
10.3 Defensive programming
10.4 Error handling
10.5 Diagnostics
10.6 Integrity and Recovery
10.7 Testability
10.8 Portability
10.9 Localization
10.10 Usability
10.11 Summary

<--Prev page | Next page -->


10.9  Localization

Localization (also called Globalization or Internationalization!) is about writing a program that can be easily ported to another language. Not to Pascal, but to French or German. This problem is not limited to simply translating the text that is shown; differences between languages include such as date and number formats, and other subtle variations. If available, a native language support library will help cope with the differences.

10.9.1  Word differences

Translation of messages are often done by a native of the target country. His task will be easier and safer if there is are no printable messages embedded in the source code. The alternative is to put them in a separate data file, which is preferably independently compiled from the main source code. This file may also include all other language-specific information, thus simplifying the localization process.

Another problem with words is where a screen layout is designed just to fit in English words, it is unlikely that the words for all other languages will fit into the same space.

Hyphenation also, varies by country. There is usually a complex algorithm, supported by an exception list (for the words which do not follow the rules).

10.9.2  Different character sets

Most languages have their own character sets, which brings a whole set of problems with it. European languages mostly use Latin characters, but with various accents, and with each letter-accent pair effectively a separate character. There are considerably less than 256 characters in each set, which enables them to be easily represented within 8 bits. If, however, you consider Asian character sets, then at least 16 bit characters are required (Chinese consists of at least 25,000 characters!).

Another problem: the order in which letters are sorted is not necessarily in numerical code order (as English is in ASCII). Thus tables are required to define collation sequence.

Capitalization also does not always follow simple rules. Thus a lower case 'e' with an acute accent capitalizes to an upper cases 'E', but which may or may not retain the accent, depending on the language.

10.9.3  Formats

Different countries format different items in different ways. Some of these items are small enough to enable them to be catered for with a simple switch within the program, whilst others will require larger amounts of code. Thus:


Date and time Almost every country has some variation on date layout. 4/5/95 may be the 4th of May or the 5th of April.

Numbers       Some countries switch the period and the comma in number formats. Thus 12,340.45 may be written 12.340,45.

Money           Each country has its own way of denoting its money symbol. Often it is a special character (eg. $) and it may be on the left or right of the number.


There are other differences which will vary by application and language. For example, problems encountered when writing a word processor will include:

  • Hyphenation algorithms vary between languages.
  • Spell checkers are different, of course. This is not as trivial as it may seem, as storage and correction systems tend to use 'sound-alike' algorithms - which will vary between languages.
  • Asian and other languages have layouts which go from right to left or top to bottom.

<--Prev page | Next page -->


Site Menu

| Home | Top | Settings |

Quality: | Quality Toolbook | Tools of the Trade | Improvement Encyclopedia | Quality Articles | Being Creative | Being Persuasive |

And: | C Style (Book) | Stories | Articles | Bookstore | My Photos | About | Contact |

Settings: | Computer layout | Mobile layout | Small font | Medium font | Large font | Translate |


You can buy books here

More Kindle books:

And the big
paperback book

Look inside


Please help and share:


| Home | Top | Menu |

© Changing Works 2002-
Massive Content -- Maximum Speed