Internationalization Using Standard C++
C/C++ User Journal, September 1997
Klaus Kreft & Angelika Langer
Computer users all over the world prefer to interact with their systems using their own language and cultural conventions. Cultural differences affect for instance the display of monetary values, of date and time. Just think of the way numeric values are formatted in different cultures: 1,000,000.00 in the US is 1.000.000,00 in Germany and 10,00,000.00 in Nepal. If you aim for high international acceptance of your products you must build into your software the flexibility to adapt to varying requirements that stem from cultural differences. Building into software the potential for worldwide use is called internationalization . It is one of the challenges of software development in these days.
Traditionally, internationalization was achieved by means of C. Standards like POSIX and X/Open define locales and wide character input and output for standard C. Windows 95 and Windows NT have a C interface, too, the Win32 NLSAPI. None of the Win32 NLSAPI interfaces matches any of the standard C interfaces though, and locales are thread-specific in Windows whereas they are provided per process in Unix. These are important differences. The concept and level of support, however, is equivalent. There is a common notion of locales, and the services provided cover almost the same range of i18n problems. Naturally, C++ cannot stand back. The ISO/ANSI C++ standard defines an extensible framework that facilitates internationalization of C++ programs in a portable manner. Its main elements are locales and facets . This article gives an overview of the locale framework and the standard facets defined by ISO/ANSI C++.