Internationalization Topics

Number Formatting

Within many non-internationalized applications, numbers assume a US English format by using commas and decimals to connote place holders. However, in some European locales, for example, numbers take the form:

1.234.567,89

The non-internationalized software code base should be updated to provide locale-dependent number formatting.

ICU (International Components for Unicode) provides robust support for locale-based number formatting; more information can be found at ICU Number Formatting.

It is debatable whether or not percentage signs ('%') are culturally acceptable across the world. You should work with your localization vendor to ascertain whether or not '%' is acceptable within its target locales. If not, the '%' should be externalized and handled like any extracted content within the system.

C Example

The following is a C example of double number formatting ("7.0") using the default locale:

UChar myString[20];
UFieldPosition pos=0;
double myNumber = 7.0;
UErrorCode success = U_ZERO_ERROR;
UNumberFormat* nf = unum_open(UNUM_DEFAULT, NULL, &success)
unum_formatDouble(nf, myNumber, myString, u_strlen(myString), &pos, &status);
printf(" Example 1: %s\n", austrdup(myString) );