Index: openacs-4/packages/acs-lang/tcl/lang-util-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/lang-util-procs.tcl,v diff -u -r1.47 -r1.48 --- openacs-4/packages/acs-lang/tcl/lang-util-procs.tcl 8 Apr 2013 15:50:25 -0000 1.47 +++ openacs-4/packages/acs-lang/tcl/lang-util-procs.tcl 27 Oct 2014 16:39:37 -0000 1.48 @@ -67,7 +67,7 @@ ad_proc lang::util::message_tag_regexp {} { The regexp expression used by proc get_temporary_tags_indices and elsewhere - to extract temporary message catalog tags (<#...#>) from adp and tcl files. + to extract temporary message catalog tags (<#...#>) from ADP and Tcl files. The first sub match of the expression is the whole tag, the second sub match is the message key, and the third sub match is the message text in en_US locale. @@ -91,7 +91,7 @@ Returns a list of two element lists containing the start and end indices of what is captured by the first parenthesis in the given regexp pattern in the multilingual string. The - regexp pattern must follow the syntax of the expression argument to the TCL regexp command. + regexp pattern must follow the syntax of the expression argument to the Tcl regexp command. It must also contain exactly one capturing parenthesis for the pieces of text that indices are to be returned for. @@ -123,12 +123,9 @@ ad_proc lang::util::replace_temporary_tags_with_lookups { file_list } { - Modify the given adp or tcl files by replacing occurencies of - - <#package_key.message_key Some text#> - - with message lookups (i.e. #package_key.message_key# for adp files - and [_ "package_key.message_key"] for tcl files) and create entries in the + Modify the given ADP or Tcl files by replacing occurencies of message keys + with message lookups (i.e. #package_key.message_key# for ADP files + and [_ "package_key.message_key"] for Tcl files) and create entries in the catalog file for each of these keys. If the short hand form <#_ Some en_US text#> is used then the key will be autogenerated based on the text. Returns the number of replacements done. This procedure only @@ -137,7 +134,7 @@ is not accessed in any way. @param file_list A list of paths to adp or tcl files to do replacements in. The - paths should be relative to [acs_root_dir]. All files must + paths should be relative to $::acs::rootdir. All files must belong to the same package. @author Peter marklund (peter@collaboraid.biz) @@ -176,7 +173,7 @@ foreach file $file_list { ns_log debug "lang::util::replace_temporary_tags_with_lookups: processing file $file" - set full_file_path "[acs_root_dir]/$file" + set full_file_path "$::acs::rootdir/$file" regexp {\.([^.]+)$} $file match file_ending # Attempt a backup of the file first. Do not overwrite an old backup file. @@ -338,15 +335,15 @@ # The replacement string starts and ends with a hash mark set replacement_string [string range $string_with_hashes [lindex $item_idx 0] \ [lindex $item_idx 1]] - set message_key [string range $replacement_string 1 [expr {[string length $replacement_string] - 2}]] + set message_key [string range $replacement_string 1 [string length $replacement_string]-2] # Attempt a message lookup set message_value [lang::message::lookup $locale $message_key "" "" 2] # Replace the string # LARS: We don't use regsub here, because regsub interprets certain characters # in the replacement string specially. - append subst_string [string range $string_with_hashes $start_idx [expr {[lindex $item_idx 0]-1}]] + append subst_string [string range $string_with_hashes $start_idx [lindex $item_idx 0]-1] append subst_string $message_value set start_idx [expr {[lindex $item_idx 1] + 1}] @@ -702,7 +699,7 @@ if { [ad_conn locale] ne "en_US" } { if { ![info exists __lang_message_lookups] } { lappend __lang_message_lookups $message_key - } elseif { [lsearch -exact $__lang_message_lookups $message_key] == -1 } { + } elseif {$message_key ni $__lang_message_lookups} { lappend __lang_message_lookups $message_key } } @@ -749,7 +746,7 @@ } { foreach lm $list { upvar $lm foreign_var - if { [exists_and_not_null foreign_var] } { + if { ([info exists foreign_var] && $foreign_var ne "") } { set foreign_var "\[$foreign_var\]" } } @@ -783,7 +780,7 @@ # Register the language keys lang::message::register en_US $package_key $message_key $text - if {[exists_and_not_null locale]} { + if {([info exists locale] && $locale ne "")} { lang::message::register $locale $package_key $message_key $text }