Index: openacs-4/packages/acs-core-docs/www/xml/developers-guide/i18n.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/xml/developers-guide/i18n.xml,v diff -u -r1.21 -r1.22 --- openacs-4/packages/acs-core-docs/www/xml/developers-guide/i18n.xml 26 May 2004 07:56:57 -0000 1.21 +++ openacs-4/packages/acs-core-docs/www/xml/developers-guide/i18n.xml 11 Jun 2004 10:13:00 -0000 1.22 @@ -15,6 +15,7 @@ + Internationalization and Localization Internationalization and Localization @@ -107,11 +108,7 @@ dates must use internationalized functions. All displayed numbers must use internationalized functions. - - User Content - OpenACS does not have a general system for supporting multiple, localized versions of user-input content. This document currently refers only to internationalizing the text in the package user interface. - - + Localizable text must be handled in ADP files, in TCL files, and in APM Parameters. OpenACS provides two approaches, message @@ -124,6 +121,11 @@ distinguished by a file naming convention. + + User Content + OpenACS does not have a general system for supporting multiple, localized versions of user-input content. This document currently refers only to internationalizing the text in the package user interface. + + Separate Templates for each Locale @@ -232,14 +234,14 @@ Dynamic key lookup: [lang::util::localize $var_with_embedded_message_keys] - In this case the message keys in the variable var_with_embedded_message_keys must appear as string literals \#package_key.message_key\# somewhere in the code. Here is an example of a dynamic lookup: - set message_key_array { dynamic_key_1 \#package_key.message_key1\# dynamic_key_2 \#package_key.message_key2\# } set my_text [lang::util::localize $message_key_array([get_dynamic_key])] + @@ -274,36 +276,34 @@ - For each message call in the text, decide on a variable name and replace + + + For each message call in the text, decide on a variable name and replace the procedure call with a variable lookup on the syntax %var_name%. Remember - to initialize a tcl variable with the same name on some line above the text. - If the text is in a tcl file you must replace variable lookups - (occurences of $var_name or ${var_name}) with %var_name% - You are now ready to follow the normal procedure and mark up the text using a + to initialize a tcl variable with the same name on some line above the text. + If the text is in a tcl file you must replace variable lookups + (occurences of $var_name or ${var_name}) with %var_name% + You are now ready to follow the normal procedure and mark up the text using a tempoarary message tag (<#_ text_with_percentage_vars#>) and run the action - replace tags with keys in the APM. + replace tags with keys in the APM. The variable values in the message are usually fetched with upvar, here is an example from dotlrn: - - ad_return_complaint 1 "Error: A [parameter::get -parameter classes_pretty_name] must have <em>no</em>[parameter::get -parameter class_instances_pretty_plural] to be deleted" - - was replaced by: - - set subject [parameter::get -localize -parameter classes_pretty_name] set class_instances [parameter::get -localize -parameter class_instances_pretty_plural] ad_return_complaint 1 [_ dotlrn.class_may_not_be_deleted] + + This kind of interpolation also works in adp files where adp variable values will be inserted into the message. @@ -493,14 +493,14 @@ - + You will now be walked through all of the selected adp pages. The UI shows you the intended changes and lets you edit or cancel them key by key. - + @@ -668,12 +668,13 @@ are always is done with one of the valid lookups described above. The script further assumes that you have perl installed and in your path. Run the script like this: - + + acs-lang/bin/check-catalog.sh package_key + + - - acs-lang/bin/check-catalog.sh package_key - + where package_key is the key of the package that you want to test. If you don't provide the package_key argument then all @@ -698,7 +699,7 @@ has a bold tag which confuses the converter into thinking there are two message keys for the text beginning "Invitations ..." where there should be one: - + Instead, we cancel those keys, edit the file manually, and put in a single temporary message tag: @@ -936,13 +937,13 @@ - + While in Translator mode, a list of all message keys appears at the bottom of each page. - + @@ -953,7 +954,7 @@ - +