Index: openacs-4/packages/acs-core-docs/www/i18n-introduction.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/i18n-introduction.html,v diff -u -N -r1.18 -r1.19 --- openacs-4/packages/acs-core-docs/www/i18n-introduction.html 27 Oct 2014 16:39:19 -0000 1.18 +++ openacs-4/packages/acs-core-docs/www/i18n-introduction.html 7 Aug 2017 23:47:50 -0000 1.19 @@ -1,5 +1,5 @@ -
+
This document describes how to develop internationalized OpenACS packages, including writing new packages with internationalization and converting old packages. Text that @@ -54,7 +54,7 @@
The advantage of the short syntax is that it's short. It's
as simple as inserting the value of a variable. Example:
- #forum.title#
+ #forum.title#
The verbose: <trn
key="package_key.message_key"
@@ -127,8 +127,8 @@
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 + (occurrences 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.
The variable values in the message are usually fetched with upvar, here is an example from dotlrn: @@ -154,7 +154,7 @@ ad_return_complaint 1 [_ dotlrn.class_may_not_be_deleted $msg_subst_list]
- When we were done going through the tcl files we ran the following + When we were done going through the Tcl files we ran the following commands to check for mistakes:
# Message tags should usually not be in curly braces since then the message lookup may not be @@ -165,7 +165,7 @@ # Check if you've forgotten space between default key and text in message tags (should return nothing)find -iname '*.tcl'|xargs egrep -i '<#_[^ ]'
-# Review the list of tcl files with no message lookups +# Review the list of Tcl files with no message lookupsfor tcl_file in $(find -iname '*.tcl'); do egrep -L '(<#|\[_)' $tcl_file; done
When you feel ready you may vist your package in the @@ -197,9 +197,9 @@
Here are a couple of examples. Say we have the following two parameters, taken directly from the dotlrn package. -
Parameter Name | Parameter Value |
---|---|
class_instance_pages_csv | #dotlrn.class_page_home_title#,Simple 2-Column;#dotlrn.class_page_calendar_title#,Simple 1-Column;#dotlrn.class_page_file_storage_title#,Simple 1-Column |
departments_pretty_name | #departments_pretty_name# |
+
Parameter Name | Parameter Value |
---|---|
class_instance_pages_csv | #dotlrn.class_page_home_title# ,Simple 2-Column;#dotlrn.class_page_calendar_title# ,Simple 1-Column;#dotlrn.class_page_file_storage_title# ,Simple 1-Column |
departments_pretty_name | #departments_pretty_name# |
Then, depending on how we retrieve the value, here's what we get: -
Command used to retrieve Value | Retrieved Value |
---|---|
parameter::get -localize -parameter class_instances_pages_csv | Kurs Startseite,Simple 2-Column;Kalender,Simple 1-Column;Dateien,Simple 1-Column |
parameter::get -localize -parameter departments_pretty_name | Abteilung |
parameter::get -parameter departments_pretty_name | #departments_pretty_name# |
+
Command used to retrieve Value | Retrieved Value |
---|---|
parameter::get -localize -parameter class_instances_pages_csv | Kurs Startseite,Simple 2-Column;Kalender,Simple 1-Column;Dateien,Simple 1-Column |
parameter::get -localize -parameter departments_pretty_name | Abteilung |
parameter::get -parameter departments_pretty_name | #departments_pretty_name# |
The value in the rightmost column in the table above is the value returned by an invocation of parameter::get. Note that for localization to happen you must use the -localize flag. @@ -210,4 +210,4 @@
Developers are responsible for creating the keys in the message
catalog, which is available at /acs-lang/admin/
-