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—2 Chapter 4: Using i18n and l10n in <strong>Sausalito</strong><br />

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

Localization means the operation by which, in a set of programs already internationalized, the<br />

developer gives the program all needed information so that it can adapt itself to handle its<br />

input and output in a fashion that is correct for some native language and cultural habits. This<br />

is a particularisation process, by which language and cultural habits. This is a particularisation<br />

process, by which generic methods already implemented in an internationalized program are<br />

used in specific ways. The programming environment puts several functions to the<br />

programmers disposal which allow this runtime configuration. The formal description of<br />

specific set of cultural habits for some country, together with all associated translations<br />

targeted to the same native language, is called the locale for this language or country. Users<br />

achieve localization of programs by setting proper values to special environment variables,<br />

prior to executing those programs, identifying which locale should be used.<br />

How Internationalization Works<br />

The <strong>Sausalito</strong> architecture provides a simple-to-use interface into a database of localized<br />

strings used for internationalizing applications. This i18N interface is similar to the GNU<br />

gettext interface, and is, in fact, a higher-level wrapper than encapsulates GNU gettext<br />

functionality.<br />

Like GNU gettext, the <strong>Sausalito</strong> i18n library allows developers to create their own<br />

databases of localized strings, and provides an interface for accessing that database from<br />

within applications. The <strong>Sausalito</strong> i18n wrapper library adds the following new functionality:<br />

¥ Strings fetched from the library are subject to an interpolation process, in which usersupplied<br />

variables and even other internationalized strings can be automatically<br />

substituted into the localized string.<br />

¥ Access to a set of routines for properly escaping the fetched strings for use in web<br />

applications, that is, for use in HTML documents or JavaScript programs.<br />

¥ Automatic negotiation of the best possible locale, from a preference-ordered list of<br />

locales.

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

Saved successfully!

Ooh no, something went wrong!