Index: openacs-4/packages/acs-core-docs/www/i18n-introduction.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/i18n-introduction.adp,v
diff -u -r1.1.2.9 -r1.1.2.10
--- openacs-4/packages/acs-core-docs/www/i18n-introduction.adp 21 Apr 2017 15:07:52 -0000 1.1.2.9
+++ openacs-4/packages/acs-core-docs/www/i18n-introduction.adp 19 May 2017 16:49:42 -0000 1.1.2.10
@@ -79,8 +79,7 @@
#package_key.message_key#
The advantage of the short syntax is that it's short.
It's as simple as inserting the value of a variable. Example:
-
-<span>#</span>forum.title#
+#forum.title#
The verbose: @@ -156,8 +155,8 @@ are). In those cases, follow these steps:
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 +%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 (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 @@ -178,7 +177,7 @@ becomes:
set msg_subst_list [list subject [parameter::get -localize -parameter classes_pretty_name] class_instances [parameter::get -localize -parameter class_instances_pretty_plural]]
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 +
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 # executed then (you can usually replace curly braces with the list command). Find message tags @@ -188,7 +187,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 package manager and run the action "Replace tags with keys and insert into @@ -220,13 +219,12 @@
#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#
Then, depending on how we retrieve the value, here's what we @@ -244,8 +242,7 @@
#departments_pretty_name#
The value in the rightmost column in the table above is the 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 -r1.18.2.9 -r1.18.2.10 --- openacs-4/packages/acs-core-docs/www/i18n-introduction.html 21 Apr 2017 15:07:52 -0000 1.18.2.9 +++ openacs-4/packages/acs-core-docs/www/i18n-introduction.html 19 May 2017 16:49:42 -0000 1.18.2.10 @@ -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:
- <span>#</span>forum.title#
+ #forum.title#
The verbose: <trn
key="package_key.message_key"
@@ -127,7 +127,7 @@
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 + 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.
@@ -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 | <span>#</span>dotlrn.class_page_home_title#,Simple 2-Column;<span>#</span>dotlrn.class_page_calendar_title#,Simple 1-Column;<span>#</span>dotlrn.class_page_file_storage_title#,Simple 1-Column |
departments_pretty_name | <span>#</span>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 | <span>#</span>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.