Section 6.8. Internationalization (I18N)


6.8. Internationalization (I18N)[26]

[26] Refer to www.li18nux.org/ to learn more about the Linux I18N Project.

How I18N affects the porting effort greatly depends on the application. If an application requires simple message catalogue conversions, date and time displays, or simple text string searches using regular expressions, porting these functionalities from HP-UX to Linux can be easy. However, if the application does more complicated text analysis, such as ones used in editors, those may be harder to port for the reason mentioned in the next paragraph.

Both HP-UX and Linux conform to the ISO naming standard locale names, [locale][_territory].[codeset], where locale is the two-character language, and territory is the two-character territory. Examples of these are en_US.iso885915 and zh_CN.gb18030. However, the locales available on each system, and locale contents, are different. Porting applications that require complicated use of available locales may require the need to learn language specificity and translation as well as modification of existing locales on Linux to get similar behavior as on HP-UX.

Table 6-12 compares HP-UX and GNU libc API support related to I18N.

Table 6-12. HP-UX and GNU libc I18N Support Comparison Table

HP-UX

GNU libc

Functions

wcscat, wcsncat, wcscmp, wcsncmp, wcscpy, wcsncpy, wcslen, wcschr, wcsrchr, wcsstr, wcspbrk, wcsspn, wcscspn, wcswcs, wcstok, wcscoll, wcwidth, wcswidth, wcsxfrm

wcscat, wcsncat, wcscmp, wcsncmp, wcscpy, wcsncpy, wcslen, wcschr, wcsrchr, wcsstr, wcspbrk, wcsspn, wcscspn, wcswcs, wcstok, wcscoll, wcwidth, wcswidth, wcsxfrm

Wide character string functions

mblen, mbrlen, wcslen, strlen, wcswidth, wcwidth

mblen, mbrlen, wcslen, strlen, wcswidth, wcwidth

Dimension functions

mbsinit, mbrtowc, wcrtomb, mbsrtowcs, wcsrtombs, btowc, wctob, mbtowc, mbstowcs, wctomb, wcstombs

mbsinit, mbrtowc, wcrtomb mbsrtowcs, wcsrtombs, btowc, wctob, mbtowc, mbstowcs wctomb, wcstombs, wcrtomb, wcsnrtombs, mbsnrtowcs

Conversion functions

iconv, iconv_open, iconv_close, genxlt

iconv, iconv_open, iconv_close

Translation functions

ngettext, dngettext, dcngettext, setlocale, textdomain, bindtextdomain, bind_textdomain_codeset, msgfmt, dumpmsg, findmsg, gencat, catclose, catopen

ngettext, dngettext, dcngettext setlocale, texTDomain, bindtextdomain, bind_textdomain_codeset, gettext, dgettext, dcgettext, catgets, gencat, catclose, catopen

Message catalogue functions

getc, getc_unlocked, getchar, getchar_unlocked, fgetc, getw, putc, putchar, fputc, putw, fgetc, getw, ungetwc, getwc, getwchar, fgetwc

getc, getc_unlocked, getchar getchar_unlockec, fgetc, getw, putc, putchar, fputc, putw, fgetc, getw, ungetwc, getwc, getwchar, fgetwc, ungetwc, fgets, ungetc, fputwc, fputws, putwc, putwchar, fputs, fgetws

Input/output functions

fwprintf, wprintf, swprintf, vfwprintf, vwprintf, vswprintf, strftime, strfmon, printf, fprintf, sprintf, wcfstime, vprintf, vfprintf, vsprintf, vsnprintf

fwprintf, wprintf, swprintf, vfwprintf, vwprintf, vswprintf, strftime, strfmon, printf, fprintf, sprintf, wcfstime, vprintf, vfprintf, vsprintf, vsnprintf

String formatting functions

iswalpha, iswupper, iswlower, iswdigit, iswxdigit, iswalnum, iswspace, iswpunct, iswprint, iswgraph, iswcntrl, wctype, iswctype, isalpha, isupper, islower, isdigit, isxdigit, isalnum, isspace, ispunct, isprint, isgraph, iscntrl, isascii

iswalpha, iswupper, iswlower iswdigit, iswxdigit, iswalnum iswspace, iswpunct, iswprint iswgraph, iswcntrl, wctype, iswctype, isalpha, isupper, islower, isdigit, isxdigit, isalnum, isspace, ispunct, isprint, isgraph, iscntrl, isascii, isblank, isspace, isupper

Character classifications

strcoll, strxfrm, wcscoll, wcwidth, wcswidth, wcsxfrm

strcoll, strxfrm, wcscoll, wcsxfrm

Collation functions

regcomp, regerror, regexec, regfree

regcomp, regexec, regerror, regfree

Regular expressions

memset, wmemchr, wmemcmp, wmemcpy, wmemmove, wmemset

memset, wmemchr, wmemcmp wmemcpy, wmemmove, wmemset, wcpcpy, wcpncpy, wcscpy, wcsncpy, wcsspn, cpcpy, cpncpy, cscpy, csncpy, csspn

String copying and filling functions

towlower, towupper, towctrans, wctrans, tolower, toupper

towlower, towupper, towctrans, wctrans, tolower, toupper

Conversion functions


On HP-UX, the decoder file is located in /usr/lib/nls/config. On Linux, you can find the decoder file in /usr/share/locale/locale.alias. On Linux, you can use the command locale -a to determine the locales installed on the system.

6.8.1. iconv Support and Message Catalogs

Linux provides the iconv(1) utility to convert traditional string encoding to unicode. To get a list of currently implemented encodings in Linux, use the iconv -list command at the Linux command prompt. In HP-UX, the file /usr/lib/nls/iconv/config.iconv lists the implemented encoding. See Chapter 3 for examples of using libiconv APIs and how to create a message catalog.




UNIX to Linux Porting. A Comprehensive Reference
UNIX to Linux Porting: A Comprehensive Reference
ISBN: 0131871099
EAN: 2147483647
Year: 2004
Pages: 175

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net