Index: openacs-4/packages/acs-authentication/tcl/local-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/local-procs.tcl,v diff -u -r1.25 -r1.25.2.1 --- openacs-4/packages/acs-authentication/tcl/local-procs.tcl 10 Nov 2003 16:16:13 -0000 1.25 +++ openacs-4/packages/acs-authentication/tcl/local-procs.tcl 24 Nov 2003 17:54:04 -0000 1.25.2.1 @@ -457,15 +457,23 @@ # Notify admin on new registration if { [parameter::get -parameter NotifyAdminOfNewRegistrationsP -default 0] } { with_catch errmsg { + set admin_email [parameter::get \ + -parameter NewRegistrationEmailAddress \ + -package_id [ad_conn subsite_id] \ + -default [ad_system_owner]] + + set admin_locale [lang::user::locale -user_id [party::get_by_email -email $admin_email]] + set system_url [ad_url] + ns_sendmail \ - [parameter::get -parameter NewRegistrationEmailAddress -package_id [ad_conn subsite_id] -default [ad_system_owner]] \ + $admin_email \ $email \ - [_ acs-subsite.lt_New_registration_at_s] \ - [_ acs-subsite.lt_first_names_last_name] + [lang::message::lookup $admin_locale acs-subsite.lt_New_registration_at_s] \ + [lang::message::lookup $admin_locale acs-subsite.lt_first_names_last_name] } { # We don't fail hard here, just log an error global errorInfo - ns_log Error "Error sending admin notification to $notification_address.\n$errorInfo" + ns_log Error "Error sending admin notification to $admin_email.\n$errorInfo" } } 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.39 -r1.39.2.1 --- openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl 11 Nov 2003 12:09:06 -0000 1.39 +++ openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl 24 Nov 2003 17:54:05 -0000 1.39.2.1 @@ -1,5 +1,5 @@ #/packages/acs-lang/tcl/lang-message-procs.tcl -ad_library { +ad_library { Routines for displaying web pages in multiple languages
@@ -309,7 +309,7 @@ key {default "TRANSLATION MISSING"} {substitution_list {}} - {upvar_level 2} + {upvar_level 1} {translator_mode_p 1} } { This proc is normally accessed through the _ procedure. @@ -353,9 +353,7 @@ @param upvar_level If there are embedded variables and no substitution list provided, this parameter specifies how many levels up to fetch the values of the variables - 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. + in the message. The default is 1. @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. @@ -586,7 +584,7 @@ @see lang::message::lookup @see lang::message::format } { - return [lang::message::lookup "" $key "TRANSLATION MISSING" $substitution_list] + return [lang::message::lookup "" $key "TRANSLATION MISSING" $substitution_list 2] } ##### @@ -625,7 +623,7 @@ } { @see lang::message::lookup } { - return [lang::message::lookup $locale $key $default] + return [lang::message::lookup $locale $key $default {} 2] } ad_proc -deprecated -warn lang_babel_translate { Index: openacs-4/packages/acs-lang/tcl/locale-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/locale-procs.tcl,v diff -u -r1.24.2.1 -r1.24.2.2 --- openacs-4/packages/acs-lang/tcl/locale-procs.tcl 24 Nov 2003 15:37:58 -0000 1.24.2.1 +++ openacs-4/packages/acs-lang/tcl/locale-procs.tcl 24 Nov 2003 17:54:05 -0000 1.24.2.2 @@ -239,12 +239,16 @@ } ad_proc -public lang::user::package_level_locale { + {-user_id ""} package_id } { Get the user's preferred package level locale for a package given by its package id. } { - set user_id [ad_conn untrusted_user_id] + # default to current user + if { [empty_string_p $user_id] } { + set user_id [ad_conn untrusted_user_id] + } # If package-level locales are turned off, or the user isn't logged in, return the empty string if { ![lang::system::use_package_level_locales_p] || $user_id == 0 } { @@ -255,51 +259,64 @@ return [util_memoize [list lang::user::package_level_locale_not_cached $user_id $package_id] [sec_session_timeout]] } -ad_proc -public lang::user::site_wide_locale {} { +ad_proc -public lang::user::site_wide_locale { + {-user_id ""} +} { Get the user's preferred site wide locale. } { + # default to current user + if { [empty_string_p $user_id] } { + set user_id [ad_conn untrusted_user_id] + } + # Cache for the lifetime of sessions (7 days) - return [util_memoize [list lang::user::site_wide_locale_not_cached [ad_conn user_id]] [sec_session_timeout]] + return [util_memoize [list lang::user::site_wide_locale_not_cached $user_id] [sec_session_timeout]] } ad_proc -public lang::user::site_wide_locale_not_cached { user_id } { Get the user's preferred site wide locale. } { - if { [ad_conn untrusted_user_id] == 0 } { + if { $user_id == 0 } { set locale [ad_get_cookie "ad_locale"] if { [empty_string_p $locale] } { set locale [lang::system::site_wide_locale] } return $locale } else { - set user_id [ad_conn untrusted_user_id] return [db_string get_user_site_wide_locale {} -default ""] } } ad_proc -public lang::user::locale { {-package_id ""} {-site_wide:boolean} + {-user_id ""} } { Get user locale preference for a given package instance. This preliminary implementation only has one site-wide setting, though. @param package_id The package for which you want to get the locale preference. @param site_wide Set this if you want to get the site-wide locale preference. + @param user_id Set this to the user you want to get the locale of, defaults to current user. } { + # default to current user + if { [empty_string_p $user_id] } { + set user_id [ad_conn untrusted_user_id] + } + # default to current connection package if { [empty_string_p $package_id] } { set package_id [ad_conn package_id] } # Try package level locale first - set locale [package_level_locale $package_id] + set locale [package_level_locale -user_id $user_id $package_id] # If there's no package setting, then use the site-wide setting if { [empty_string_p $locale] } { - set locale [site_wide_locale] + set locale [site_wide_locale -user_id $user_id] } return $locale