Intlize C++ runtime interface

General

The functions described here are provided by the libintlize library, version 0 of the interface.

Type definitions

Class i5e

This class is a C++ wrapper for the intlize C runtime interface. Since it provides an additional amount of safety, using the C interface from within C++ is not supported.

Public contructor:

i5e ( )

Description:

The constructor attempts to create a catalog on the heap. It allways completes successfully, even if the creation of the catalog fails.

Public destructor:

~i5e ( )

Description:

The destructor closes the catalog, if neccessary and frees all memory associated with the class.

Public member functions:

int open ( const char* lang, const char* path, const char* charset )

Description:

The file containing the requested translation is opened and copied into the catalog. If charset is not NULL, the messages will be converted to charset when accessed.

Return value:

0 on successful completion, error code otherwise.

lang:

The language code of the translation.

path:

The colon separated search path to the message catalogs. A placeholder "%L" is replaced with lang, then the first 5 characters of lang, then the first 2 characters of lang.

charset:

The target charset of the catalog, or NULL if no conversion should be performed. If libintlize was built without iconv support, charset must be NULL.

void close ( )

Description:

Closes the catalog and frees the memory associated with it.

const char* error_text ( int errnum )

Description:

Use this function to retrieve a descriptive message for errnum.

return value:

A descriptive message for errnum.

errnum:

The error code returned by open

const char* get_id ( )

Description:

This is an access function for the ID of the catalog.

return value:

The ID of the catalog.

const char* getmsg ( int msgnum )

Description:

This function retrieves the translated messages for msgnum.

Return value:

The translated message.

msgnum:

The message number of the message as assigned by intlize.

Error codes

General

0: (Success)

No error occurred.

3: (Out of memory)

Allocating a chunk of memory failed.

6: (Argument error)

The arguments given to open failed a logical check due to one or more of the following:
The constructor failed to allocate the memory for the catalog.
Lang or path is NULL or an empty string.

File I/O

1: (File not found)

The file requested by lang and path does not exist or is not accessible.

2: (File could not be opened)

The file is not accessible.

4: (Wrong file type)

The file exists and is accessible, but it is not an intlize file.

5: (Unexpected end of file)

The file ended prematurely.

Charset conversion

7: (Unknown encoding)

The encoding of the catalog is not known to intlize.

8: (No suitable converter found)

Libiconv cannot convert to the charset requested by charset.

9: (Charset conversion not implemented)

A conversion to charset is requested, but libintlize was built without libiconv support.