Index: openacs-4/packages/xotcl-core/tcl/30-widget-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/30-widget-procs.tcl,v diff -u -r1.14 -r1.15 --- openacs-4/packages/xotcl-core/tcl/30-widget-procs.tcl 4 Jun 2007 12:29:49 -0000 1.14 +++ openacs-4/packages/xotcl-core/tcl/30-widget-procs.tcl 11 Jun 2007 22:04:51 -0000 1.15 @@ -39,16 +39,27 @@ set ::xo::acs_lang_url [apm_package_url_from_key acs-lang]admin - proc localize text { + proc localize {text {inline 0}} { + #ns_log notice "--local $text $inline" if {![my exists __localizer]} { my set __localizer [list] } if {[string first \x002 $text] == -1} { return $text } else { set return_text "" + if {$inline} { + # Attempt to move all message keys outside of tags + while { [regsub -all {(<[^>]*)(\x002\(\x001[^\x001]*\x001\)\x002)([^>]*>)} $text {\2\1\3} text] } {} + + # Attempt to move all message keys outside of statements + regsub -all -nocase {(]*>[^<]*)(\x002\(\x001[^\x001]*\x001\)\x002)([^<]*]*>)} $text {\2\1\3} text + + while { [regsub -all -nocase {(]*>[^<]*)(\x002\(\x001[^\x001]*\x001\)\x002)} $text {\2\1} text] } {} + } + while {[regexp {^([^\x002]*)\x002\(\x001([^\x001]*)\x001\)\x002(.*)$} $text _ \ - before key text]} { + before key text]} { append return_text $before foreach {package_key message_key} [split $key .] break set url [export_vars -base $::xo::acs_lang_url/edit-localized-message { @@ -67,7 +78,12 @@ }] set type missing } - my lappend __localizer [::xo::Localizer new -type $type -key $key -url $url] + if {!$inline} { + my lappend __localizer [::xo::Localizer new -type $type -key $key -url $url] + } else { + set l [::xo::Localizer new -type $type -key $key -url $url] + append return_text [$l asHTML] + } } append return_text $text return $return_text