Index: openacs-4/packages/acs-core-docs/www/i18n.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/i18n.html,v diff -u -r1.13.2.3 -r1.13.2.4 --- openacs-4/packages/acs-core-docs/www/i18n.html 8 Dec 2003 15:41:17 -0000 1.13.2.3 +++ openacs-4/packages/acs-core-docs/www/i18n.html 15 Dec 2003 15:03:47 -0000 1.13.2.4 @@ -28,7 +28,17 @@ database must use internationalized functions. All displayed dates must use internationalized functions. All displayed numbers must use internationalized functions. -

Using the Message Catalog

+

AOLserver Configuration for Multilingual Sites

+ For multilingual websites we recommend using the UTF8 + charset. In order for AOLserver to use utf8 you need to set + the config parameters OutputCharset and + URLCharset to utf-8 in your AOLserver config file (use the etc/config.tcl + template file). For sites running on Oracle you need to make + sure that AOLserver is running with the NLS_LANG environment + variable set to .UTF8. You should set this variable in the + nsd-oracle run script (use the + acs-core-docs/www/files/nds-oracle.txt template file). +

Using the Message Catalog

Localizable text must be handled in ADP files, in TCL files, and in APM Parameters. OpenACS provides two approaches, message keys and localized ADP files. For ADP pages which are mostly @@ -38,7 +48,7 @@ which are static and mostly text, it may be easier to create a new ADP page for each language. In this case, the pages are distinguished by a file naming convention. -

Separate Templates for each Locale

If the request processor finds a file named filename.locale.adp, where locale matches the user's locale, it will process that file instead of filename.adp. For example, for a user with locale tl_PH, the file index.tl_PH.adp, if found, will be used instead of index.adp. The locale-specific file should thus contain text in the language appropriate for that locale. The code in the page, however, should still be in English. Message keys are still processed.

Message Keys in Template Files (ADP Files)

+

Separate Templates for each Locale

If the request processor finds a file named filename.locale.adp, where locale matches the user's locale, it will process that file instead of filename.adp. For example, for a user with locale tl_PH, the file index.tl_PH.adp, if found, will be used instead of index.adp. The locale-specific file should thus contain text in the language appropriate for that locale. The code in the page, however, should still be in English. Message keys are still processed.

Message Keys in Template Files (ADP Files)

Internationalizing templates is about replacing human readable text in a certain language with internal message keys, which can then be dynamically replaced with real human language in @@ -151,7 +161,7 @@ Use the *_pretty version in your ADP page.

To internationalize numbers, use lc_numeric $value, which formats the number using the appropriate decimal point and thousand separator for the locale. -

Internationalizing Forms

When coding forms, remember to use message keys for each piece of text that is user-visible, including form option labels and button labels.

Internationalizing Existing Packages

Internationalize Message text in ADP and TCL

Acs-lang includes tools to automate some +

Internationalizing Forms

When coding forms, remember to use message keys for each piece of text that is user-visible, including form option labels and button labels.

Internationalizing Existing Packages

Internationalize Message text in ADP and TCL

Acs-lang includes tools to automate some internationalization. From /acs-admin/apm/, select a package and then click on @@ -240,9 +250,9 @@ with the appropriate notation for the type of file, and store the text in the message catalog. You need to run the process twice, once for ADP files, and once for Tcl files. -

Internationalize Package Parameters with visible messages

+

Internationalize Package Parameters with visible messages

See Multilingual APM Parameters -

Internationalize Date and Time queries

  1. Find datetime in .xql files. Use command line tools to find suspect SQL code:

    grep -r "to_char.*H" *
    +    

Internationalize Date and Time queries

  1. Find datetime in .xql files. Use command line tools to find suspect SQL code:

    grep -r "to_char.*H" *
     grep -r "to_date.*H" *
     
  2. In SQL statements, replace the format string with the ANSI standard format, YYYY-MM-DD HH24:MI:SS and change the field name to *_ansi so that it cannot be confused with previous, improperly formatting fields. For example,

    to_char(timestamp,'MM/DD/YYYY HH:MI:SS') as foo_date_pretty

    becomes

    to_char(timestamp,'YYYY-MM-DD HH24:MI:SS') as foo_date_ansi
  3. In TCL files where the date fields are used, convert the datetime from local server timezone, which is how it's stored in the database, to the user's timezone for display. Do this with the localizing function lc_time_system_to_conn:

     set foo_date_ansi [lc_time_system_to_conn $foo_date_ansi]

    When a datetime will be written to the database, first convert it from the user's local time to the server's timezone with lc_time_conn_to_system.