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.8 -r1.9 --- openacs-4/packages/acs-lang/tcl/lang-util-procs.tcl 28 Oct 2002 12:48:02 -0000 1.8 +++ openacs-4/packages/acs-lang/tcl/lang-util-procs.tcl 29 Oct 2002 08:06:31 -0000 1.9 @@ -189,6 +189,7 @@ # Read the contents of the file set file_contents [template::util::read_file $full_file_path] + set modified_file_contents $file_contents # Loop over each message tag in the file @@ -285,7 +286,7 @@ # Update the file with the replaced message keys set file_id [open "${full_file_path}" w] - puts $file_id "$modified_file_contents" + puts -nonewline $file_id $modified_file_contents close $file_id } @@ -473,15 +474,21 @@ regsub -all {@[a-zA-Z0-9_\.]+@} $text "" text_wo_variables - # make sure the string is non empty and contains at least one letter. + # make sure the string is not empty, doesn't contain all spaces, is at least one character long, + # contains alphabetical characters, doesn't contain all   if {![empty_string_p $text] && ![string is space $text_wo_variables] - && [string match -nocase {*[A-Z]*} $text] - && ![string match {*\#*} $text] - && ![string match {*\{*} $text] - && ![string match {*\}*} $text] && [string length $text] > 1 + && [string match -nocase {*[A-Z]*} $text] + && ![regexp {(?:\s* \s*)+} $text_wo_variables match] } { + # Peter: texts with a hash or curly brace used to be excluded, my thinking + # is it's better to include those texts and let the user say if they should + # be included or not now that this script is used interactively in the APM. + #&& ![string match {*\#*} $text] + #&& ![string match {*\{*} $text] + #&& ![string match {*\}*} $text] + regexp {^(\s*)(.*?)(\s*)$} $text match lead text lag set text_w_percentages [convert_adp_variables_to_percentage_signs $text] @@ -493,7 +500,7 @@ set key [suggest_key $text] - lappend report [list $key "[string range [remove_gt_lt $out$lead] end-20 end]$text[string range [remove_gt_lt $lag$s] 0 20]" ] + lappend report [list $key "[string range [remove_gt_lt $out$lead] end-20 end]$text[string range [remove_gt_lt $lag$s] 0 20]" ] } else { # Write mode if { [llength $keys] != 0} { @@ -512,12 +519,12 @@ if { ![empty_string_p $write_key] } { # Write tag to file - lappend report [list ${write_key} "[string range [remove_gt_lt $out$lead] end-20 end]$text[string range [remove_gt_lt $lag$s] 0 20]" ] + lappend report [list ${write_key} "[string range [remove_gt_lt $out$lead] end-20 end]$text[string range [remove_gt_lt $lag$s] 0 20]" ] append out "$lead<\#${write_key} $text_w_percentages\#>$lag" } else { # Leave the text untouched - lappend garbage "[string range [remove_gt_lt $out$lead] end-20 end]$text [string range [remove_gt_lt $lag$s] 0 20]" + lappend garbage "[string range [remove_gt_lt $out$lead] end-20 end]$text [string range [remove_gt_lt $lag$s] 0 20]" append out "$lead$text$lag" } }