Index: openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl,v
diff -u -r1.30 -r1.31
--- openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl	25 Sep 2003 16:20:15 -0000	1.30
+++ openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl	30 Sep 2003 10:10:24 -0000	1.31
@@ -281,6 +281,7 @@
     {default "TRANSLATION MISSING"}
     {substitution_list {}}
     {upvar_level 2}
+    {translator_mode_p 1}
 } {
     This proc is normally accessed through the _ procedure.
 
@@ -326,6 +327,10 @@
                               in the message. The reason the default is 2 is that the lookup proc is
                               usually invoked by the underscore proc (_). Set upvar level to less than
                               1 if you don't want variable interpolation to be done.
+    
+    @param translator_mode_p  Set to 0 if you do not want this call to honor translator mode. 
+                              Useful if you're not using this message in the page itself, but e.g.
+                              for localization data or for the list of messages on the page.
 
     @author Jeff Davis (davis@arsdigita.com)
     @author Henry Minsky (hqm@arsdigita.com)
@@ -361,11 +366,6 @@
         }
     } 
 
-    if { [lang::util::translator_mode_p] } {
-        # Translator mode - record the message lookup
-        lang::util::record_message_lookup $key
-    }
-
     # We remember the passed-in locale, because we want the translator mode to show which 
     # messages have been translated, and which have not.
     set org_locale $locale
@@ -409,6 +409,23 @@
         set message [lang::message::format $message $substitution_list [expr $upvar_level + 1]]
     }
 
+    if { [lang::util::translator_mode_p] } {
+        # Translator mode - record the message lookup
+        lang::util::record_message_lookup $key
+        
+        if { $translator_mode_p } {
+            global message_key_num
+            if { ![info exists message_key_num] } {
+                set message_key_num 1
+            } else {
+                incr message_key_num
+            }
+            
+            # LARS: Trying new translator more -- encode the key in the page
+            set message "$message\x002\[\x001$key\x001\]\x002"
+        }
+    }
+
     return $message
 }