- 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.53 2024/09/11 06:15:48 gustafn Exp $
Procedures in this file
- lang::conn::browser_locale (private)
- lang::conn::charset (public)
- lang::conn::get_accept_language_header (private)
- lang::conn::language (public)
- lang::conn::locale (public)
- lang::conn::locale_not_cached (private)
- lang::conn::timezone (public)
- lang::conn::valid_locale_p (private)
- lang::system::get_locale_options (public)
- lang::system::get_locale_options_not_cached (private)
- lang::system::get_locales (public)
- lang::system::language (public)
- lang::system::locale (public)
- lang::system::locale_set_enabled (public)
- lang::system::package_level_locale (public)
- lang::system::package_level_locale_not_cached (private)
- lang::system::set_locale (public)
- lang::system::set_timezone (public)
- lang::system::site_wide_locale (public)
- lang::system::timezone (public)
- lang::system::timezone_utc_offset (public)
- lang::system::use_package_level_locales_p (public)
- lang::user::language (public)
- lang::user::locale (public)
- lang::user::package_level_locale (public)
- lang::user::package_level_locale_not_cached (private)
- lang::user::set_locale (public)
- lang::user::set_timezone (public)
- lang::user::site_wide_locale (public)
- lang::user::site_wide_locale_not_cached (private)
- lang::user::timezone (public)
- lang::user::timezone_no_cache (private)
Detailed information
lang::conn::browser_locale (private)
lang::conn::browser_locale
Get the users preferred locale from the accept-language HTTP header.
- Returns:
- A locale or an empty string if no locale can be found that is supported by the system
- Authors:
- Lars Pind
- Peter Marklund
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- locale__test_lang_conn_browser_locale
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):
- Testcases:
- test_get_locales
lang::conn::get_accept_language_header (private)
lang::conn::get_accept_language_header
Obtain a list of locals from the request headers.
- Returns:
- a list of locales in the syntax used by OpenACS (ISO codes)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
lang::conn::language (public)
lang::conn::language [ -package_id package_id ] [ -user_id user_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 (used only when, no locale is provided).
- -user_id (optional)
- The user_id for whom you want to get the language (used only when, no locale is provided).
- -site_wide (optional, boolean)
- Set this if you want to get the site-wide language (used only when, no locale is provided).
- -iso6392 (optional, boolean)
- 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):
- Testcases:
- test_get_locales
lang::conn::locale (public)
lang::conn::locale [ -package_id package_id ] [ -site_wide ] \ [ -user_id user_id ]
Get the locale for this request, perhaps for a given package instance.
- Switches:
- -package_id (optional)
- The package for which you want to get the locale.
- -site_wide (optional, boolean)
- Set this if you want to get the site-wide locale.
- -user_id (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- test_get_locales
lang::conn::locale_not_cached (private)
lang::conn::locale_not_cached [ -package_id package_id ] \ [ -site_wide ] [ -user_id user_id ]
Get the locale for this request, perhaps for a given package instance. This is the not-cached version.
- Switches:
- -package_id (optional)
- The package for which you want to get the locale.
- -site_wide (optional, boolean)
- Set this if you want to get the site-wide locale.
- -user_id (optional)
- Partial Call Graph (max 5 caller/called nodes):
- 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):
- Testcases:
- lang_test__lc_procs, set_get_timezone, set_timezone_not_logged_in, lc_time_fmt_Z_timezone, a_foreign_calendar_user
lang::conn::valid_locale_p (private)
lang::conn::valid_locale_p locale
Check, of the provided locale is syntactically correct
- Parameters:
- locale (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
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):
- Testcases:
- test_get_locales
lang::system::get_locale_options_not_cached (private)
lang::system::get_locale_options_not_cached
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):
- Testcases:
- No testcase defined.
lang::system::get_locales (public)
lang::system::get_locales [ -all ]
Return all locales defined in the system. Per default only the enabled locales are returned. When the optional flag "-all" is specified, all defined locales are returned. This value is cached per thread and needs currently a server restart, when the system locales are changed.
- Switches:
- -all (optional, boolean)
- Author:
- Peter Marklund
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- test_get_locales, xowiki_test_cases
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 (optional, boolean)
- Set this if you want to get the site-wide language setting.
- -iso6392 (optional, boolean)
- 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):
- Testcases:
- test_get_locales
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 (optional, boolean)
- Set this if you want to get the site-wide locale setting.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- dt_localized_procs, locale__test_system_package_setting, test_get_locales, create_test_items, create_composite_test_item, create_folder_with_page, create_workflow_with_instance, link_tests, path_resolve, create_form_with_form_instance, create_form_with_numeric, form_validate
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):
- Testcases:
- lang_test__lc_procs, locale__test_lang_conn_browser_locale, locale_language_fallback, upgrade
lang::system::package_level_locale (public)
lang::system::package_level_locale package_id
- Parameters:
- package_id (required)
- 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):
- Testcases:
- test_get_locales
lang::system::package_level_locale_not_cached (private)
lang::system::package_level_locale_not_cached package_id
- Parameters:
- package_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- 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 (required)
- The new locale that you want to use as your system locale.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- dt_localized_procs, locale__test_system_package_setting, test_get_locales, link_tests, slot_interactions, path_resolve
lang::system::set_timezone (public)
lang::system::set_timezone timezone
Tell OpenACS what timezone we think it's running in.
- Parameters:
- timezone (required)
- name from acs-reference package (e.g., Asia/Tokyo, America/New_York)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- lang_test__lc_procs, 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):
- Testcases:
- locale__test_system_package_setting, ad_context_bar_multirow
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):
- Testcases:
- set_get_timezone, set_timezone_not_logged_in, test_timezone_offset, a_foreign_calendar_user
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):
- Testcases:
- test_timezone_offset
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):
- Testcases:
- test_get_locales
lang::user::language (public)
lang::user::language [ -package_id package_id ] [ -user_id user_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.
- -user_id (optional)
- The user we wish to get the language for, defaults to connection user.
- -site_wide (optional, boolean)
- Set this if you want to get the site-wide language setting.
- -iso6392 (optional, boolean)
- 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):
- Testcases:
- test_get_locales
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 (optional, boolean)
- 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):
- Testcases:
- test_get_locales, create_form_with_numeric
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 (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- test_get_locales
lang::user::package_level_locale_not_cached (private)
lang::user::package_level_locale_not_cached user_id package_id
Get the user's preferred package level locale for a package given by its package id. Will return the empty string if the user has not preference for the package.
- Parameters:
- user_id (required)
- package_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- 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 (required)
- The new locale that you want to use as your system locale.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- lang_test__lang_user_site_wide_locale, test_get_locales, create_form_with_numeric
lang::user::set_timezone (public)
lang::user::set_timezone timezone
Set the user's timezone setting.
- Parameters:
- timezone (required)
- name from acs-reference package (e.g., Asia/Tokyo, America/New_York)
- Partial Call Graph (max 5 caller/called nodes):
- 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):
- Testcases:
- lang_test__lang_user_site_wide_locale
lang::user::site_wide_locale_not_cached (private)
lang::user::site_wide_locale_not_cached user_id
Get the user's preferred site-wide locale.
- Parameters:
- user_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- 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):
- Testcases:
- set_get_timezone
lang::user::timezone_no_cache (private)
lang::user::timezone_no_cache user_id
- Parameters:
- user_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.