Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
2.  General Internationalization Features Internationalization APIs in libc  Previous   Contents   Next 
   
 

The following table describes the monetary handling function APIs in libc.

Table 2-9 Monetary Formatting in libc

Library Routine

Description

localeconv()

Get monetary formatting information for the current locale

strfmon()

Convert monetary value to string representation

The following table describes the date and time formatting in libc.

Table 2-10 Date and Time Formatting in libc

Library Routine

Description

getdate()

Convert user format date and time.

strftime()

Convert date and time to string representation. The %u conversion function conforms to the X/Open CAE Specification, System Interfaces and Headers, Issue 4, Version 2. This function represents a weekday as a decimal number [1,7], with 1 now representing Monday.

strptime()

Date and time conversion.

The following table describes the multibyte handling function APIs in libc.

Table 2-11 Multibyte Handling in libc

Library Routine

Description

btowc()

Single-byte to wide-character conversion

mbrlen()

Get number of bytes in character (restartable)

mbsinit()

Determine conversion object status

mbrtowc()

Convert a character to a wide-character code (restartable)

mbsrtowcs()

Convert a character string to a wide-character string (restartable)

mblen()

Get number of bytes in a character

mbtowc()

Convert a character to a wide-character code

mbstowcs()

Convert a character string to a wide-character string

The following table describes the wide character and string handling in libc.

Table 2-12 Wide Character and String Handling in libc

Library Routine

Description

wcsncat()

Concatenate wide-character strings to length n

wsdup()

Duplicate wide-character string

wcscmp()

Compare wide-character strings

wcsncmp()

Compare wide-character strings to length n

wcscpy()

Copy wide-character strings

wcsncpy()

Copy wide-character strings to length n

wcschr()

Find character in wide-character string

wcsrchr()

Find character in wide-character string from right

wcslen()

Get length of wide-character string 

wscol()

Return display width of wide-character string

wcsspn()

Return span of one wide-character string in another

wcscspn()

Return span of one wide-character string not in another

wcspbrk()

Return pointer to one wide-character string in another

wcstok()

Move token through wide-character string

wscwcs()

Find string in wide-character string

wcstombs()

Convert wide-character string to multibyte string

wctomb()

Convert wide-character to multibyte character

wcwidth()

Determine number of column positions of a wide character

wcswidth()

Determine number of column positions of a wide-character string

wctob()

Wide character to single byte conversion

wcrtomb()

Convert a wide-character code to a character (restartable)

wcstol()

Convert wide-character string to long integer

wcstoul()

Convert wide-character string to unsigned long integer

wcstod()

Convert wide-character string to double precision

wcsrtombs()

Convert a wide-character string to a character string (restartable)

wcscat()

Concatenate wide-character strings

The following table describes the formatted wide-character input and output in libc.

Table 2-13 Formatted Wide-character Input and Output in libc

Library Routine

Description

  

wsprintf()

Generate wide-character string according to format

wsscanf()

Formatted input conversion

fwprintf()

Print formatted wide-character output

fwscanf()

Convert formatted wide-character input

wprintf()

Print formatted wide-character output

wscanf()

Convert formatted wide-character input

swprintf()

Print formatted wide-character output

swscanf()

Convert formatted wide-character input

vfwprintf()

Wide-character formatted output of a stdarg argument list

vswprintf()

Wide-character formatted output of a stdarg argument list

This table describes the wide strings function APIs in libc.

Table 2-14 Wide Stringslibc

Library Routine

Description

wscasecmp()

Compare wide-character strings, ignore case differences

wsncasecmp()

Process code-string operations

wcsstr()

Find a wide-character substring

wmemchr()

Find a wide character in memory

wmemcmp()

Compare wide characters in memory

wmemcpy()

Copy wide characters in memory

wmemmove()

Copy wide characters in memory with overlapping areas

wmemset()

Set wide characters in memory

The following table describes the wide-character input and output in libc.

Table 2-15 Wide-character Input and Output inlibc

Library Routine

Description

fgetwc()

Get multibyte character from stream, convert to wide character

getwchar()

Get multibyte character from stdin, convert to wide character

fgetws()

Get multibyte string from stream, convert to wide character

getws()

Get multibyte string from stdin, convert to wide character

fputwc()

Convert wide character to multibyte character, puts to stream

fwide()

Set stream orientation

putwchar()

Convert wide character to multibyte character, puts to stdin

fputws()

Convert wide character to multibyte string, puts to stream

putws()

Convert wide character to multibyte string, puts to stdin

ungetwc()

Push a wide character back into input stream.

genmsg Utility

The new genmsg utility can be used with the catgets() family of functions to create internationalized source message catalogs. The utility examines a source program file for calls to functions in catgets and builds a source message catalog from the information it finds. For example:

% cat example.c
	...
	/* NOTE: %s is a file name */
	printf(catgets(catd, 5, 1, "%s cannot be opened."));
	/* NOTE: "Read" is a past participle, not a present
 
			tense verb */
	printf(catgets(catd, 5, 1, "Read"));
	...
% genmsg -c NOTE example.c
The following file(s) have been created.
			new msg file = "example.c.msg"
% cat example.c.msg
$quote "
$set 5
1			"%s cannot be opened"
	/* NOTE: %s is a file name */
2			"Read"
	/* NOTE: "Read" is a past participle, not a present
			tense verb */

In the above example, genmsg is run on the source file example.c, which produces a source message catalog named example.c.msg. The -c option with the argument NOTE causes genmsg to include comments in the catalog. If a comment in the source program contains the string specified, the comment appears in the message catalog after the next string extracted from a call to catgets.

You can use genmsg to number the messages in a message set automatically.

For more information, see the genmsg(1) man page.

To generate a formatted message catalog file, use the gencat(1) utility.

For information on the message extraction utility for Portable Message files (.po files) and also on how to generate message object files (.mo files) from the .po files, see the xgettext(1), and msgfmt(1) man pages, respectively.

 
 
 
  Previous   Contents   Next