Index: openacs-4/packages/acs-lang/www/doc/i18n-design.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/doc/i18n-design.adp,v diff -u -N -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/acs-lang/www/doc/i18n-design.adp 20 Aug 2015 17:43:22 -0000 1.1.2.1 +++ openacs-4/packages/acs-lang/www/doc/i18n-design.adp 25 Aug 2015 18:02:07 -0000 1.1.2.2 @@ -2,16 +2,20 @@ {/doc/acs-lang {Localization}} {ACS 4 Globalization Detailed Design} ACS 4 Globalization Detailed Design - -

ACS 4 Globalization Detailed Design

+ by Henry Minsky

I. Essentials

+ When applicable, each of the following items should receive its own link:

II. Introduction

III. Historical Considerations

V. Design Tradeoffs

+

II. Introduction

+

III. Historical Considerations

+

V. Design Tradeoffs

+ + Areas of interest to developers:

VI. API

VI.A Locale API

10.30 A Locale object represents a specific geographical, + +

VI. API

+

VI.A Locale API

+10.30 + A Locale object represents a specific geographical, political, or cultural region. An operation that requires a Locale to perform its task is called locale-sensitive and uses the Locale to tailor information for the user. For example, displaying a @@ -45,27 +54,36 @@

We will refer to a Locale by a combination of a language and country. In the Java Locale API there is an optional variant which can -be added to a locale, which we will omit in the Tcl API.

The language is a valid ISO Language Code. These +be added to a locale, which we will omit in the Tcl API.

+

The language is a valid ISO Language Code. These codes are the lower-case two-letter codes as defined by ISO-639. You can find a full list of these codes at a number of sites, such as:
http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt -

The country is a valid ISO Country Code. These +

+

The country is a valid ISO Country Code. These codes are the upper-case two-letter codes as defined by ISO-3166. You can find a full list of these codes at a number of sites, such as:
http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html -

Examples are

-en_US English US
ja_JP Japanese
fr_FR France French.

The i18n module figures out the locale for a current request -makes it accessible via the ad_locale function:

+

+

Examples are

+
+en_US English US
ja_JP Japanese
fr_FR France French.
+

The i18n module figures out the locale for a current request +makes it accessible via the ad_locale function:

+
 [ad_locale user locale
 ] => fr_FR
 [ad_locale subsite locale
 ] => en_US
 
+ It has not yet been decided how the user's preferred locale will be initialized. For now, there is a site wide default package parameter [parameter::get -parameter DefaultLocale -default -"en_US"], and an API for setting the locale with the +"en_US"] +, and an API for setting the locale with the preference stored in a session variable: The ad_locale_set + function is used to set the user's preferred locale to a desired value. It saves the value in the current session.
@@ -77,32 +95,44 @@
 
     
 
+ The request processor should use the ad_locale API to figure out the preferred locale for a request (perhaps combining user preference with subsite defaults in some way). It will make this -information accesible via the ad_conn function: -
ad_conn locale

Character Sets and Encodings

-We refer to MIME character set names which are the valid +information accesible via the ad_conn + function: +
ad_conn locale
+

Character Sets and Encodings

+ +We refer to MIME character set names + which are the valid values which can be passed in a MIME header, such as
 Content-Type: text/html; charset=iso-8859-1
-

You can obtain the preferred character set for a locale via the -ad_locale API shown below:

+
+

You can obtain the preferred character set for a locale via the +ad_locale API shown below:

+
 set locale "en_US"
 [ad_locale charset $locale
 ] => "iso-8859-1" or "shift_jis"
 
+ Returns a case-insensitive name of a MIME character set.

We already have an AOLserver function to convert a MIME charset -name to a Tcl encoding name:

+name to a Tcl encoding name:

+
 [ns_encodingforcharset "iso-8859-1"] => iso8859-1
-

Templating

+
+

Templating

+ The goal of templates is to separate program logic from data presentation.

For presenting data in multiple languages, there are two basic ways to use templates for a given abstract URL. Say we have the URL "foo", for example. We can provide templates for it in the -following ways: