• Publicity: Public Only All

locale-procs.tcl

Localization procedures for OpenACS

This is free software distributed under the terms of the GNU Public License. Full text of the license is available from the GNU Project: http://www.fsf.org/copyleft/gpl.html

Location:
packages/acs-lang/tcl/locale-procs.tcl
Created:
28 September 2000
Authors:
Henry Minsky <hqm@mit.edu>
Lars Pind <lars@pinds.com>
CVS Identification:
$Id: locale-procs.tcl,v 1.51.2.1 2019/06/19 18:10:40 gustafn Exp $

Procedures in this file

Detailed information

lang::conn::charset (public)

 lang::conn::charset

Returns the MIME charset name corresponding to the current connection's locale.

Returns:
IANA MIME character set name
Author:
Lars Pind <lars@pinds.com>

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.

lang::conn::language (public)

 lang::conn::language [ -package_id package_id ] [ -site_wide ] \
    [ -iso6392 ] [ -locale locale ]

Get the language for this request, perhaps for a given package instance.

Switches:
-package_id (optional)
The package for which you want to get the language.
-site_wide (boolean) (optional)
Set this if you want to get the site-wide language.
-iso6392 (boolean) (optional)
Set this if you want to force the iso-639-2 code
-locale (optional)
obtain language from provided locale
Returns:
3 chars language code if iso6392 is set, left part of locale otherwise

Partial Call Graph (max 5 caller/called nodes):
%3 richtext::ckeditor4::initialize_widget richtext::ckeditor4::initialize_widget (public) lang::conn::language lang::conn::language richtext::ckeditor4::initialize_widget->lang::conn::language richtext::ckeditor5::initialize_widget richtext::ckeditor5::initialize_widget (public) richtext::ckeditor5::initialize_widget->lang::conn::language richtext::xinha::render_widgets richtext::xinha::render_widgets (public) richtext::xinha::render_widgets->lang::conn::language

Testcases:
No testcase defined.

lang::conn::locale (public)

 lang::conn::locale [ -package_id package_id ] [ -site_wide ]

Get the locale for this request, perhaps for a given package instance. This procedure will never return an error. Everything that could fail is wrapped in a catch.

Switches:
-package_id (optional)
The package for which you want to get the locale.
-site_wide (boolean) (optional)
Set this if you want to get the site-wide locale.

Partial Call Graph (max 5 caller/called nodes):
%3 lang::conn::charset lang::conn::charset (public) lang::conn::locale lang::conn::locale lang::conn::charset->lang::conn::locale lang::conn::language lang::conn::language (public) lang::conn::language->lang::conn::locale packages/acs-lang/lib/change-locale-bar.tcl packages/acs-lang/ lib/change-locale-bar.tcl packages/acs-lang/lib/change-locale-bar.tcl->lang::conn::locale ad_conn ad_conn (public) lang::conn::locale->ad_conn

Testcases:
No testcase defined.

lang::conn::timezone (public)

 lang::conn::timezone

Get this connection's timezone. This is the user timezone, if set, otherwise the system timezone.

Returns:
a timezone name from acs-reference package (e.g., Asia/Tokyo, America/New_York)

Partial Call Graph (max 5 caller/called nodes):
%3 test_lc_time_fmt_Z_timezone lc_time_fmt_Z_timezone (test acs-lang) lang::conn::timezone lang::conn::timezone test_lc_time_fmt_Z_timezone->lang::conn::timezone test_set_get_timezone set_get_timezone (test acs-lang) test_set_get_timezone->lang::conn::timezone test_set_timezone_not_logged_in set_timezone_not_logged_in (test acs-lang) test_set_timezone_not_logged_in->lang::conn::timezone ad_conn ad_conn (public) lang::conn::timezone->ad_conn lc_time_conn_to_system lc_time_conn_to_system (public) lc_time_conn_to_system->lang::conn::timezone lc_time_local_to_utc lc_time_local_to_utc (public) lc_time_local_to_utc->lang::conn::timezone lc_time_system_to_conn lc_time_system_to_conn (public) lc_time_system_to_conn->lang::conn::timezone lc_time_utc_to_local lc_time_utc_to_local (public) lc_time_utc_to_local->lang::conn::timezone packages/acs-lang/tcl/localization-data-init.tcl packages/acs-lang/ tcl/localization-data-init.tcl packages/acs-lang/tcl/localization-data-init.tcl->lang::conn::timezone

Testcases:
set_get_timezone, set_timezone_not_logged_in, lc_time_fmt_Z_timezone

lang::system::get_locale_options (public)

 lang::system::get_locale_options

Return all enabled locales in the system in a format suitable for the options argument of a form.

Author:
Lars Pind

Partial Call Graph (max 5 caller/called nodes):
%3 lang::system::locale_set_enabled lang::system::locale_set_enabled (public) lang::system::get_locale_options lang::system::get_locale_options lang::system::locale_set_enabled->lang::system::get_locale_options packages/acs-lang/www/admin/message-list.tcl packages/acs-lang/ www/admin/message-list.tcl packages/acs-lang/www/admin/message-list.tcl->lang::system::get_locale_options packages/categories/lib/tree-form.tcl packages/categories/ lib/tree-form.tcl packages/categories/lib/tree-form.tcl->lang::system::get_locale_options packages/categories/www/cadmin/category-form.tcl packages/categories/ www/cadmin/category-form.tcl packages/categories/www/cadmin/category-form.tcl->lang::system::get_locale_options packages/categories/www/cadmin/master.tcl packages/categories/ www/cadmin/master.tcl packages/categories/www/cadmin/master.tcl->lang::system::get_locale_options util_memoize util_memoize (public) lang::system::get_locale_options->util_memoize

Testcases:
No testcase defined.

lang::system::get_locales (public)

 lang::system::get_locales

Return all enabled locales in the system. This value is cached per thread and needs currently a server restart, when the system locales are changed.

Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 lang::conn::browser_locale lang::conn::browser_locale (private) lang::system::get_locales lang::system::get_locales lang::conn::browser_locale->lang::system::get_locales lang::system::locale_set_enabled lang::system::locale_set_enabled (public) lang::system::locale_set_enabled->lang::system::get_locales lang::system::site_wide_locale lang::system::site_wide_locale (public) lang::system::site_wide_locale->lang::system::get_locales packages/acs-lang/www/admin/package-list.tcl packages/acs-lang/ www/admin/package-list.tcl packages/acs-lang/www/admin/package-list.tcl->lang::system::get_locales packages/acs-subsite/www/group-master.tcl packages/acs-subsite/ www/group-master.tcl packages/acs-subsite/www/group-master.tcl->lang::system::get_locales util_memoize util_memoize (public) lang::system::get_locales->util_memoize

Testcases:
No testcase defined.

lang::system::language (public)

 lang::system::language [ -package_id package_id ] [ -site_wide ] \
    [ -iso6392 ]

Get system language setting for a given package instance.

Switches:
-package_id (optional)
The package for which you want to get the language setting.
-site_wide (boolean) (optional)
Set this if you want to get the site-wide language setting.
-iso6392 (boolean) (optional)
Set this if you want to force iso-639-2 code (3 digits)
Returns:
3 chars language code if iso6392 is set, left part of locale otherwise

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.

lang::system::locale (public)

 lang::system::locale [ -package_id package_id ] [ -site_wide ]

Get system locale setting for a given package instance.

Switches:
-package_id (optional)
The package for which you want to get the locale setting.
-site_wide (boolean) (optional)
Set this if you want to get the site-wide locale setting.

Partial Call Graph (max 5 caller/called nodes):
%3 test_locale__test_system_package_setting locale__test_system_package_setting (test acs-lang) lang::system::locale lang::system::locale test_locale__test_system_package_setting->lang::system::locale ad_conn ad_conn (public) lang::system::locale->ad_conn ::xowiki::test::create_form_page ::xowiki::test::create_form_page ::xowiki::test::create_form_page->lang::system::locale category::get_name category::get_name (public) category::get_name->lang::system::locale lang::conn::get_accept_language_header lang::conn::get_accept_language_header (private) lang::conn::get_accept_language_header->lang::system::locale lang::message::lookup lang::message::lookup (public) lang::message::lookup->lang::system::locale lang::system::get_locales_not_cached lang::system::get_locales_not_cached (private) lang::system::get_locales_not_cached->lang::system::locale

Testcases:
locale__test_system_package_setting

lang::system::locale_set_enabled (public)

 lang::system::locale_set_enabled -locale locale -enabled_p enabled_p

Enables or disables a locale.

Switches:
-locale (required)
-enabled_p (required)
Should be t or f
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 test_lang_test__lc_numeric lang_test__lc_numeric (test acs-lang) lang::system::locale_set_enabled lang::system::locale_set_enabled test_lang_test__lc_numeric->lang::system::locale_set_enabled test_locale__test_lang_conn_browser_locale locale__test_lang_conn_browser_locale (test acs-lang) test_locale__test_lang_conn_browser_locale->lang::system::locale_set_enabled test_upgrade upgrade (test acs-lang) test_upgrade->lang::system::locale_set_enabled db_dml db_dml (public) lang::system::locale_set_enabled->db_dml util_memoize_flush_regexp util_memoize_flush_regexp (public) lang::system::locale_set_enabled->util_memoize_flush_regexp install::xml::action::disable-locale install::xml::action::disable-locale (private) install::xml::action::disable-locale->lang::system::locale_set_enabled install::xml::action::enable-locale install::xml::action::enable-locale (private) install::xml::action::enable-locale->lang::system::locale_set_enabled packages/acs-lang/www/admin/locale-set-enabled-p.tcl packages/acs-lang/ www/admin/locale-set-enabled-p.tcl packages/acs-lang/www/admin/locale-set-enabled-p.tcl->lang::system::locale_set_enabled

Testcases:
lang_test__lc_numeric, locale__test_lang_conn_browser_locale, upgrade

lang::system::package_level_locale (public)

 lang::system::package_level_locale package_id
Parameters:
package_id
Returns:
empty string if not use_package_level_locales_p, or the package locale from apm_packages table.

Partial Call Graph (max 5 caller/called nodes):
%3 lang::conn::locale lang::conn::locale (public) lang::system::package_level_locale lang::system::package_level_locale lang::conn::locale->lang::system::package_level_locale lang::system::locale lang::system::locale (public) lang::system::locale->lang::system::package_level_locale util_memoize util_memoize (public) lang::system::package_level_locale->util_memoize

Testcases:
No testcase defined.

lang::system::set_locale (public)

 lang::system::set_locale [ -package_id package_id ] locale

Set system locale setting for a given package instance, or the site-wide system locale.

Switches:
-package_id (optional)
The package for which you want to set the locale setting, if you want to set system setting for one package only. Leave blank for site-wide setting.
Parameters:
locale - The new locale that you want to use as your system locale.

Partial Call Graph (max 5 caller/called nodes):
%3 test_locale__test_system_package_setting locale__test_system_package_setting (test acs-lang) lang::system::set_locale lang::system::set_locale test_locale__test_system_package_setting->lang::system::set_locale apm_package_id_from_key apm_package_id_from_key (public) lang::system::set_locale->apm_package_id_from_key db_dml db_dml (public) lang::system::set_locale->db_dml util_memoize_flush util_memoize_flush (public) lang::system::set_locale->util_memoize_flush install::xml::action::set-system-locale install::xml::action::set-system-locale (private) install::xml::action::set-system-locale->lang::system::set_locale

Testcases:
locale__test_system_package_setting

lang::system::set_timezone (public)

 lang::system::set_timezone timezone

Tell OpenACS what timezone we think it's running in.

Parameters:
timezone - name from acs-reference package (e.g., Asia/Tokyo, America/New_York)

Partial Call Graph (max 5 caller/called nodes):
%3 test_set_get_timezone set_get_timezone (test acs-lang) lang::system::set_timezone lang::system::set_timezone test_set_get_timezone->lang::system::set_timezone apm_package_id_from_key apm_package_id_from_key (public) lang::system::set_timezone->apm_package_id_from_key packages/acs-lang/www/admin/set-system-timezone.tcl packages/acs-lang/ www/admin/set-system-timezone.tcl packages/acs-lang/www/admin/set-system-timezone.tcl->lang::system::set_timezone

Testcases:
set_get_timezone

lang::system::site_wide_locale (public)

 lang::system::site_wide_locale

Get the site wide system locale setting.

Partial Call Graph (max 5 caller/called nodes):
%3 test_locale__test_system_package_setting locale__test_system_package_setting (test acs-lang) lang::system::site_wide_locale lang::system::site_wide_locale test_locale__test_system_package_setting->lang::system::site_wide_locale apm_package_id_from_key apm_package_id_from_key (public) lang::system::site_wide_locale->apm_package_id_from_key auth::local::registration::Register auth::local::registration::Register (private) auth::local::registration::Register->lang::system::site_wide_locale callback::search::datasource::impl::forums_message callback::search::datasource::impl::forums_message (public) callback::search::datasource::impl::forums_message->lang::system::site_wide_locale forum::format::reply_subject forum::format::reply_subject (public) forum::format::reply_subject->lang::system::site_wide_locale forum::message::datasource forum::message::datasource (private) forum::message::datasource->lang::system::site_wide_locale lang::conn::locale lang::conn::locale (public) lang::conn::locale->lang::system::site_wide_locale

Testcases:
locale__test_system_package_setting

lang::system::timezone (public)

 lang::system::timezone

Ask OpenACS what it thinks our timezone is.

Returns:
a timezone name from acs-reference package (e.g., Asia/Tokyo, America/New_York)

Partial Call Graph (max 5 caller/called nodes):
%3 test_set_get_timezone set_get_timezone (test acs-lang) lang::system::timezone lang::system::timezone test_set_get_timezone->lang::system::timezone test_set_timezone_not_logged_in set_timezone_not_logged_in (test acs-lang) test_set_timezone_not_logged_in->lang::system::timezone apm_package_id_from_key apm_package_id_from_key (public) lang::system::timezone->apm_package_id_from_key fs::rss::datasource fs::rss::datasource (private) fs::rss::datasource->lang::system::timezone lang::conn::timezone lang::conn::timezone (public) lang::conn::timezone->lang::system::timezone lang::system::timezone_utc_offset lang::system::timezone_utc_offset (public) lang::system::timezone_utc_offset->lang::system::timezone lc_time_conn_to_system lc_time_conn_to_system (public) lc_time_conn_to_system->lang::system::timezone lc_time_system_to_conn lc_time_system_to_conn (public) lc_time_system_to_conn->lang::system::timezone

Testcases:
set_get_timezone, set_timezone_not_logged_in

lang::system::timezone_utc_offset (public)

 lang::system::timezone_utc_offset
Returns:
number of hours to subtract from local (database) time to get UTC

Partial Call Graph (max 5 caller/called nodes):
%3 packages/acs-lang/www/admin/set-system-timezone.tcl packages/acs-lang/ www/admin/set-system-timezone.tcl lang::system::timezone_utc_offset lang::system::timezone_utc_offset packages/acs-lang/www/admin/set-system-timezone.tcl->lang::system::timezone_utc_offset db_string db_string (public) lang::system::timezone_utc_offset->db_string

Testcases:
No testcase defined.

lang::system::use_package_level_locales_p (public)

 lang::system::use_package_level_locales_p

Returns whether we're using package level locales.

Partial Call Graph (max 5 caller/called nodes):
%3 lang::system::package_level_locale lang::system::package_level_locale (public) lang::system::use_package_level_locales_p lang::system::use_package_level_locales_p lang::system::package_level_locale->lang::system::use_package_level_locales_p lang::user::package_level_locale lang::user::package_level_locale (public) lang::user::package_level_locale->lang::system::use_package_level_locales_p packages/acs-lang/www/change-locale-include.tcl packages/acs-lang/ www/change-locale-include.tcl packages/acs-lang/www/change-locale-include.tcl->lang::system::use_package_level_locales_p apm_package_id_from_key apm_package_id_from_key (public) lang::system::use_package_level_locales_p->apm_package_id_from_key

Testcases:
No testcase defined.

lang::user::language (public)

 lang::user::language [ -package_id package_id ] [ -site_wide ] \
    [ -iso6392 ]

Get user language preference for a given package instance. This preliminary implementation only has one site-wide setting, though.

Switches:
-package_id (optional)
The package for which you want to get the language setting.
-site_wide (boolean) (optional)
Set this if you want to get the site-wide language setting.
-iso6392 (boolean) (optional)
Set this if you want to force iso-639-2 code (3 digits)
Returns:
3 chars language code if iso6392 is set, left part of locale otherwise

Partial Call Graph (max 5 caller/called nodes):
%3 packages/acs-lang/www/admin/test/catalog-test.tcl packages/acs-lang/ www/admin/test/catalog-test.tcl lang::user::language lang::user::language packages/acs-lang/www/admin/test/catalog-test.tcl->lang::user::language packages/acs-lang/www/index.tcl packages/acs-lang/ www/index.tcl packages/acs-lang/www/index.tcl->lang::user::language

Testcases:
No testcase defined.

lang::user::locale (public)

 lang::user::locale [ -package_id package_id ] [ -site_wide ] \
    [ -user_id user_id ]

Get user locale preference for a given package instance.

Switches:
-package_id (optional)
The package for which you want to get the locale preference.
-site_wide (boolean) (optional)
Set this if you want to get the site-wide locale preference.
-user_id (optional)
Set this to the user you want to get the locale of, defaults to current user.

Partial Call Graph (max 5 caller/called nodes):
%3 auth::local::registration::Register auth::local::registration::Register (private) lang::user::locale lang::user::locale auth::local::registration::Register->lang::user::locale lang::user::language lang::user::language (public) lang::user::language->lang::user::locale packages/acs-lang/www/admin/test/catalog-test.tcl packages/acs-lang/ www/admin/test/catalog-test.tcl packages/acs-lang/www/admin/test/catalog-test.tcl->lang::user::locale packages/acs-lang/www/index.tcl packages/acs-lang/ www/index.tcl packages/acs-lang/www/index.tcl->lang::user::locale packages/acs-subsite/www/members/member-state-change.tcl packages/acs-subsite/ www/members/member-state-change.tcl packages/acs-subsite/www/members/member-state-change.tcl->lang::user::locale ad_conn ad_conn (public) lang::user::locale->ad_conn

Testcases:
No testcase defined.

lang::user::package_level_locale (public)

 lang::user::package_level_locale [ -user_id user_id ] package_id

Get the user's preferred package level locale for a package given by its package id.

Switches:
-user_id (optional)
Parameters:
package_id

Partial Call Graph (max 5 caller/called nodes):
%3 lang::conn::locale lang::conn::locale (public) lang::user::package_level_locale lang::user::package_level_locale lang::conn::locale->lang::user::package_level_locale lang::user::locale lang::user::locale (public) lang::user::locale->lang::user::package_level_locale packages/acs-lang/www/change-locale-include.tcl packages/acs-lang/ www/change-locale-include.tcl packages/acs-lang/www/change-locale-include.tcl->lang::user::package_level_locale ad_conn ad_conn (public) lang::user::package_level_locale->ad_conn sec_session_timeout sec_session_timeout lang::user::package_level_locale->sec_session_timeout util_memoize util_memoize (public) lang::user::package_level_locale->util_memoize

Testcases:
No testcase defined.

lang::user::set_locale (public)

 lang::user::set_locale [ -package_id package_id ] [ -user_id user_id ] \
    locale

Set user locale setting for a given package instance.

Switches:
-package_id (optional)
The package for which you want to set the locale setting, if you want to set it for a specific package, as opposed to a site-wide setting.
-user_id (optional)
Parameters:
locale - The new locale that you want to use as your system locale.

Partial Call Graph (max 5 caller/called nodes):
%3 acs::test::user::create acs::test::user::create (public) lang::user::set_locale lang::user::set_locale acs::test::user::create->lang::user::set_locale packages/acs-lang/www/change-locale-include.tcl packages/acs-lang/ www/change-locale-include.tcl packages/acs-lang/www/change-locale-include.tcl->lang::user::set_locale packages/acs-lang/www/change-locale.tcl packages/acs-lang/ www/change-locale.tcl packages/acs-lang/www/change-locale.tcl->lang::user::set_locale packages/acs-subsite/lib/user-info.tcl packages/acs-subsite/ lib/user-info.tcl packages/acs-subsite/lib/user-info.tcl->lang::user::set_locale packages/acs-subsite/lib/user-new.tcl packages/acs-subsite/ lib/user-new.tcl packages/acs-subsite/lib/user-new.tcl->lang::user::set_locale ad_conn ad_conn (public) lang::user::set_locale->ad_conn ad_set_cookie ad_set_cookie (public) lang::user::set_locale->ad_set_cookie db_dml db_dml (public) lang::user::set_locale->db_dml db_string db_string (public) lang::user::set_locale->db_string util_memoize_flush util_memoize_flush (public) lang::user::set_locale->util_memoize_flush

Testcases:
No testcase defined.

lang::user::set_timezone (public)

 lang::user::set_timezone timezone

Set the user's timezone setting.

Parameters:
timezone - name from acs-reference package (e.g., Asia/Tokyo, America/New_York)

Partial Call Graph (max 5 caller/called nodes):
%3 test_set_get_timezone set_get_timezone (test acs-lang) lang::user::set_timezone lang::user::set_timezone test_set_get_timezone->lang::user::set_timezone test_set_timezone_not_logged_in set_timezone_not_logged_in (test acs-lang) test_set_timezone_not_logged_in->lang::user::set_timezone ad_conn ad_conn (public) lang::user::set_timezone->ad_conn db_dml db_dml (public) lang::user::set_timezone->db_dml util_memoize_flush util_memoize_flush (public) lang::user::set_timezone->util_memoize_flush packages/acs-lang/www/change-locale-include.tcl packages/acs-lang/ www/change-locale-include.tcl packages/acs-lang/www/change-locale-include.tcl->lang::user::set_timezone packages/acs-subsite/lib/user-info.tcl packages/acs-subsite/ lib/user-info.tcl packages/acs-subsite/lib/user-info.tcl->lang::user::set_timezone

Testcases:
set_get_timezone, set_timezone_not_logged_in

lang::user::site_wide_locale (public)

 lang::user::site_wide_locale [ -user_id user_id ]

Get the user's preferred site wide locale.

Switches:
-user_id (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 lang::conn::locale lang::conn::locale (public) lang::user::site_wide_locale lang::user::site_wide_locale lang::conn::locale->lang::user::site_wide_locale lang::user::locale lang::user::locale (public) lang::user::locale->lang::user::site_wide_locale notification::email::send notification::email::send (public) notification::email::send->lang::user::site_wide_locale packages/acs-lang/www/change-locale-include.tcl packages/acs-lang/ www/change-locale-include.tcl packages/acs-lang/www/change-locale-include.tcl->lang::user::site_wide_locale ad_conn ad_conn (public) lang::user::site_wide_locale->ad_conn sec_session_timeout sec_session_timeout lang::user::site_wide_locale->sec_session_timeout util_memoize util_memoize (public) lang::user::site_wide_locale->util_memoize

Testcases:
No testcase defined.

lang::user::timezone (public)

 lang::user::timezone

Get the user's timezone. Returns the empty string if the user has no timezone set.

Returns:
a timezone name from acs-reference package (e.g., Asia/Tokyo, America/New_York)

Partial Call Graph (max 5 caller/called nodes):
%3 test_set_get_timezone set_get_timezone (test acs-lang) lang::user::timezone lang::user::timezone test_set_get_timezone->lang::user::timezone ad_conn ad_conn (public) lang::user::timezone->ad_conn util_memoize util_memoize (public) lang::user::timezone->util_memoize lang::conn::timezone lang::conn::timezone (public) lang::conn::timezone->lang::user::timezone packages/acs-lang/www/change-locale-include.tcl packages/acs-lang/ www/change-locale-include.tcl packages/acs-lang/www/change-locale-include.tcl->lang::user::timezone packages/acs-subsite/lib/user-info.tcl packages/acs-subsite/ lib/user-info.tcl packages/acs-subsite/lib/user-info.tcl->lang::user::timezone

Testcases:
set_get_timezone
[ show source ]