Logo Search packages:      
Sourcecode: icu version File versions  Download package

Functions | Variables

ucat.h File Reference

C API: Message Catalog Wrappers. More...

#include "unicode/utypes.h"
#include "unicode/ures.h"
Include dependency graph for ucat.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


U_STABLE void U_EXPORT2 u_catclose (u_nl_catd catd)
U_STABLE const UChar *U_EXPORT2 u_catgets (u_nl_catd catd, int32_t set_num, int32_t msg_num, const UChar *s, int32_t *len, UErrorCode *ec)
U_STABLE u_nl_catd U_EXPORT2 u_catopen (const char *name, const char *locale, UErrorCode *ec)



Detailed Description

C API: Message Catalog Wrappers.

This C API provides look-alike functions that deliberately resemble the POSIX catopen, catclose, and catgets functions. The underlying implementation is in terms of ICU resource bundles, rather than POSIX message catalogs.

The ICU resource bundles obey standard ICU inheritance policies. To facilitate this, sets and messages are flattened into one tier. This is done by creating resource bundle keys of the form <set_num>%<msg_num> where set_num is the set number and msg_num is the message number, formatted as decimal strings.

Example: Consider a message catalog containing two sets:

Set 1: Message 4 = "Good morning." Message 5 = "Good afternoon." Message 7 = "Good evening." Message 8 = "Good night." Set 4: Message 14 = "Please " Message 19 = "Thank you." Message 20 = "Sincerely,"

The ICU resource bundle source file would, assuming it is named "greet.txt", would look like this:

greet { 14 { "Good morning." } 15 { "Good afternoon." } 17 { "Good evening." } 18 { "Good night." }

414 { "Please " } 419 { "Thank you." } 420 { "Sincerely," } }

The catgets function is commonly used in combination with functions like printf and strftime. ICU components like message format can be used instead, although they use a different format syntax. There is an ICU package, icuio, that provides some of the POSIX-style formatting API.

Definition in file ucat.h.

Generated by  Doxygen 1.6.0   Back to index