Dear all,
I have found a weird behaviour in lang::user::set_locale and need help and suggestion.
I am running a tri-lingual site that would switch languages between English, Simplified Chinese and Traditaional Chinese. I use /acs-lang/change-locale?user_locale=$locale&return_url=$path to switch language. Mostly the page can be changed but occassionally the browser has no effect on the language change.
I tracked the code of lang::user::set_locale in acs-lang/tcl/locale-procs.tcl and put ns_log mark and found that the line "util_memoize_flush [list lang::user::site_wide_locale_not_cached $user_id]" seems not to be excuted (I put some log mark insdie lang::user::site_wide_locale_not_cached but not displayed).
This problem is persisted that the weird response will not disappeared once it happened on a particular browser and PC until the cookie was removed. But it would appear sometimes later in unpredictable manner.
I use OpenACS 4.6 and the code snippet in acs-lang/tcl/locale-procs.tcl for your reference at the end of this post.
Thank you for any suggestion.
Kevin
++++++++++++++ code +++++++++++++++++++
ad_proc -public lang::user::set_locale {
{-package_id ""}
locale
} {
set user_id [ad_conn user_id]
if { $user_id == 0 } {
# Not logged in, use a cookie-based client locale
ad_set_cookie -replace t -max_age inf "ad_locale" $locale
# Flush the site-wide user preference cache
util_memoize_flush [list lang::user::site_wide_locale_not_cached $user_id]
return
}
...
...