22.07.2013 Views

Sausalito Developer's Guide - Parent Directory

Sausalito Developer's Guide - Parent Directory

Sausalito Developer's Guide - Parent Directory

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4—6 Chapter 4: Using i18n and l10n in <strong>Sausalito</strong><br />

Beta Draft 11. Copyright ' 2001.Cobalt Networks, Inc. All Rights Reserved.<br />

The i18n Interface<br />

\r -> return<br />

\t -> tab<br />

\v -> vertical newline<br />

\(char) -> literal character<br />

Rule 3. Tags are subject to the following expansion rules:<br />

If the domain equals VAR, then variable expansion occurs. The variable specified in tagname<br />

is looked up in the current hash of variables. Its value is interpolated according to these rules<br />

and its value is substituted here.<br />

If the domain is not equal to VAR, than the domain token is interpreted as the name of a i18n<br />

domain. The tagname token is interpreted as a message identifier, and the appropriate substring<br />

is fetched from the i18n database and interpolated.<br />

Rule 4. The expanded unescaped tokens are reassembled into a single internationalized string.<br />

Application developers use the following interface to fetch properly interpolated and escaped<br />

strings from the i18n database. Generally, the programmer first calls a constructor to create a<br />

new i18n object, perform a number of fetch operations, and then destroy the i18n object.<br />

The i18n object performs its own memory management on strings that it returns. When the<br />

i18n object is destroyed, all memory allocated for various strings is freed automatically.<br />

The i18n library is a C library, but Perl and PHP bindings are provided in addition to the C<br />

interface. These various interfaces to the i18n library are documented below.<br />

The i18n C Language Interface<br />

The function prototypes for the C language interface are in the following include file:<br />

/usr/sausalito/include/cce/i18n.h<br />

The link library for i18n is in these directories:<br />

/usr/sausalito/lib/libi18n.a (library for static linking)<br />

/usr/sausalito/lib/libi18n.so (library for dynamic linking)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!