Index: openacs-4/packages/acs-lang/ACS4.1b-PATCHES/README =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/ACS4.1b-PATCHES/Attic/README,v diff -u -N --- openacs-4/packages/acs-lang/ACS4.1b-PATCHES/README 20 Apr 2001 20:51:08 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,48 +0,0 @@ - -Sun Jan 21 23:20:56 2001 - -This will apply a couple of patches to help handle multiple -languages and character sets. - -To apply the patch run the script "./install.sh path_to_your_acs" -so for example of your acs installation is in /web/myserver do - -./install.sh /web/myserver - -================================================================ - -This installs the following patches: - -+ Allow you to author tcl and adp files in an alternate character set -besides the AOLserver Tcl system default. - -The system will assume the script file is authored in the character -set which corresponds to the mime type of the file, which you can -modify in your .ini or .tcl AOLSERVER config file. For example, to author -tcl and adp files in ShiftJIS, you would use the following settings -in your .tcl file: - - ns_section ns/mimetypes - ns_param .html "text/html" - ns_param .tcl "text/html; charset=shift_jis" - ns_param .adp "text/html; charset=shift_jis" - -The files will be output in the character set specified in the -MIME type, unless you override it by setting the content-type -header explicitly in the script or adp file, using the following tcl code: - -.tcl file: - ns_set put [ns_conn outputheaders] "content-type" "text/html; charset=iso-8859-7" - -.adp file: (sets the output to iso-8859-7) - -<% - ns_set put [ns_conn outputheaders] "content-type" "text/html; charset=iso-8859-7" -%> - - -+ A new adp tag, TRN is defined, which will call the message catalog -lookup function. This is documented in the acs-lang package design -document (packages/acs-lang/www/doc/i18n-design.html) or developers -guide. - Index: openacs-4/packages/acs-lang/ACS4.1b-PATCHES/install.sh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/ACS4.1b-PATCHES/Attic/install.sh,v diff -u -N --- openacs-4/packages/acs-lang/ACS4.1b-PATCHES/install.sh 20 Apr 2001 20:51:08 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,15 +0,0 @@ -#!/bin/sh - -echo $0 -echo $1 - -if [ "$1" = "" ]; then - echo 1>&2 "usage: $0 /path/to/your/webserver" - exit 1 -fi - -WEBROOT=$1 - -patch -d ${WEBROOT}/packages/acs-templating/tcl < util-procs.patch -patch -d ${WEBROOT}/packages/acs-tcl/tcl < request-processor-procs.patch -patch -d ${WEBROOT}/packages/acs-templating/tcl < tag-init.patch Index: openacs-4/packages/acs-lang/ACS4.1b-PATCHES/request-processor-procs.patch =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/ACS4.1b-PATCHES/Attic/request-processor-procs.patch,v diff -u -N --- openacs-4/packages/acs-lang/ACS4.1b-PATCHES/request-processor-procs.patch 20 Apr 2001 20:51:08 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,86 +0,0 @@ -*** ./packages/acs-tcl/tcl/request-processor-procs.tcl Thu Jan 11 07:52:40 2001 ---- /web/acs41b/packages/acs-tcl/tcl/request-processor-procs.tcl Sun Jan 21 22:43:49 2001 -*************** -*** 879,905 **** - - } { - namespace eval template variable parse_level [info level] -! source [ad_conn file] - } - - ad_proc -private rp_handle_adp_request {} { - - Handles a request for an .adp file. - - } { - doc_init -! set adp [ns_adp_parse -file [ad_conn file]] - - if { [doc_exists_p] } { - doc_set_property body $adp - doc_serve_document - } else { -! set content_type [ns_set iget [ad_conn outputheaders] "content-type"] -! if { $content_type == "" } { -! set content_type "text/html" -! } - doc_return 200 $content_type $adp - } - } - - ad_proc -private rp_handle_html_request {} { ---- 879,932 ---- - - } { - namespace eval template variable parse_level [info level] -! source_with_encoding [ad_conn file] - } - -+ - ad_proc -private rp_handle_adp_request {} { - - Handles a request for an .adp file. - - } { - doc_init -! -! set mimetype [ns_guesstype [ad_conn file]] -! -! set encoding [ns_encodingfortype $mimetype] -! -! set fd [open [ad_conn file] r] -! fconfigure $fd -encoding $encoding -! set template [read $fd] -! close $fd -! -! set adp [ns_adp_parse -string $template] - - if { [doc_exists_p] } { - doc_set_property body $adp - doc_serve_document - } else { -! set content_type [ns_set iget [ns_conn outputheaders] "content-type"] -! if { $content_type == "" } { -! set content_type [ns_guesstype [ad_conn file]] -! } else { -! ns_set idelkey [ns_conn outputheaders] "content-type" -! } - doc_return 200 $content_type $adp - } -+ } -+ -+ ad_proc -private source_with_encoding {filename} { loads filename, using a charset encoding -+ looked up via the ns_encodingforcharset command, based on the ns_guesstype MIME -+ type of the filename. } { -+ set type [ns_guesstype $filename] -+ set encoding [ns_encodingfortype $type] -+ set fd [open $filename r] -+ fconfigure $fd -encoding $encoding -+ set code [read $fd] -+ close $fd -+ # set the default output encoding to the file mime type -+ ns_startcontent -type $type -+ uplevel 1 $code - } - - ad_proc -private rp_handle_html_request {} { Index: openacs-4/packages/acs-lang/ACS4.1b-PATCHES/tag-init.patch =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/ACS4.1b-PATCHES/Attic/tag-init.patch,v diff -u -N --- openacs-4/packages/acs-lang/ACS4.1b-PATCHES/tag-init.patch 20 Apr 2001 20:51:08 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,44 +0,0 @@ -*** ./packages/acs-templating/tcl/tag-init.tcl Fri Jan 12 05:55:03 2001 ---- /web/acs41b/packages/acs-templating/tcl/tag-init.tcl Sun Jan 21 22:52:51 2001 -*************** -*** 407,409 **** ---- 407,444 ---- - - template::adp_append_string "" - } -+ -+ -+ # Compile a call to the the translation message catalog. -+ # If the "static" attribute is present in the tag, then -+ # do the lookup at compile time, otherwise emit a call to -+ # do the lookup at runtime. -+ template_tag trn { chunk params } { -+ -+ set key [ns_set iget $params key] -+ set lang [ns_set iget $params lang] -+ set type [ns_set iget $params type] -+ -+ if [empty_string_p $type] { -+ set type user -+ } -+ -+ if {[empty_string_p $lang]} { -+ set lang [ad_locale $type locale] -+ } -+ -+ # Is the "static" attribute present? -+ set static_p [expr [ns_set find $params static] >= 0] -+ -+ # If "static" attribute is present, do the call now -+ if {$static_p} { -+ set msg [lang_message_lookup $lang $key $chunk] -+ # quote dollar signs, square bracket and quotes -+ regsub -all {[\]\[""\\$]} $msg {\\&} quoted_msg -+ template::adp_append_code "append __adp_output {$quoted_msg}" -+ } else { -+ # emit code to call lang_message_lookup at runtime -+ template::adp_append_code "append __adp_output \[lang_message_lookup \[ad_locale $type language\] {$key}\]" -+ } -+ -+ } -\ No newline at end of file Index: openacs-4/packages/acs-lang/ACS4.1b-PATCHES/util-procs.patch =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/ACS4.1b-PATCHES/Attic/util-procs.patch,v diff -u -N --- openacs-4/packages/acs-lang/ACS4.1b-PATCHES/util-procs.patch 20 Apr 2001 20:51:08 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,33 +0,0 @@ -*** ./packages/acs-templating/tcl/util-procs.tcl Fri Jan 12 11:50:24 2001 ---- /web/acs41b/packages/acs-templating/tcl/util-procs.tcl Sun Jan 21 22:41:28 2001 -*************** -*** 414,425 **** - - proc template::util::read_file { path } { - -! set fd [open $path] -! set text [read $fd] -! close $fd - -! return $text - } - - # @public write_file - ---- 414,429 ---- - - proc template::util::read_file { path } { - -! set type [ns_guesstype $path] -! set encoding [ns_encodingfortype $type] -! set fd [open $path r] -! fconfigure $fd -encoding $encoding -! set text [read $fd] -! close $fd - -! return $text - } -+ - - # @public write_file -