lang::user::site_wide_locale_not_cached (private)

 lang::user::site_wide_locale_not_cached user_id

Defined in packages/acs-lang/tcl/locale-procs.tcl

Get the user's preferred site-wide locale.

Parameters:
user_id (required)

Partial Call Graph (max 5 caller/called nodes):
%3 lang::user::site_wide_locale lang::user::site_wide_locale (public) lang::user::site_wide_locale_not_cached lang::user::site_wide_locale_not_cached lang::user::site_wide_locale->lang::user::site_wide_locale_not_cached ad_get_cookie ad_get_cookie (public) lang::user::site_wide_locale_not_cached->ad_get_cookie ad_unset_cookie ad_unset_cookie (public) lang::user::site_wide_locale_not_cached->ad_unset_cookie db_string db_string (public) lang::user::site_wide_locale_not_cached->db_string lang::system::get_locales lang::system::get_locales (public) lang::user::site_wide_locale_not_cached->lang::system::get_locales lang::system::site_wide_locale lang::system::site_wide_locale (public) lang::user::site_wide_locale_not_cached->lang::system::site_wide_locale

Testcases:
No testcase defined.
Source code:
    set system_locale [lang::system::site_wide_locale]

    if { $user_id == 0 } {
        set cookie_name [security::cookie_name locale]
        set locale [ad_get_cookie $cookie_name]
        if {$locale ne ""} {
            #
            # Check, if someone hacked the cookie
            #
            if {$locale ni [lang::system::get_locales]} {
                ns_log warning "ignoring invalid ad_locale cookie '$locale'"
                set locale ""
                #
                # The cookie was invalid, so get rid of it.
                #
                ad_unset_cookie $cookie_name
            }
        }
    } else {
        set locale [db_string get_user_site_wide_locale {} -default ""]
    }

    #
    # When no locale cookie is set, or the locale is invalid or empty,
    # fall back to system locale.
    #
    if { $locale eq "" } {
        set locale $system_locale
    }

    return $locale
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
<fullquery name="lang::user::site_wide_locale_not_cached.get_user_site_wide_locale">
    <querytext>
        select locale
        from   user_preferences
        where  user_id = :user_id
      </querytext>
</fullquery>
packages/acs-lang/tcl/locale-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: