lang-util-procs.tcl

Utility routines for translating pages. Many of these procs deal with message keys embedded in strings with the #key# or the <#key text#> syntax.

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/lang-util-procs.tcl
Created:
10 September 2000
Authors:
Jeff Davis <davis@xarg.net>
Bruno Mattarollo <bruno.mattarollo@ams.greenpeace.org>
Peter Marklund <peter@collaboraid.biz>
Lars Pind <lars@collaboraid.biz>
Christian Hvid
CVS Identification:
$Id: lang-util-procs.tcl,v 1.56 2024/09/11 06:15:48 gustafn Exp $

Procedures in this file

Detailed information

lang::util::charset_for_locale (public)

 lang::util::charset_for_locale locale

Returns the MIME charset name corresponding to a locale.

Parameters:
locale (required)
Name of a locale, as language_COUNTRY using ISO 639 and ISO 3166
Returns:
IANA MIME character set name
Author:
Henry Minsky <hqm@mit.edu>

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_get_locales test_get_locales (test acs-lang) lang::util::charset_for_locale lang::util::charset_for_locale test_test_get_locales->lang::util::charset_for_locale db_string db_string (public) lang::util::charset_for_locale->db_string lang::catalog::get_catalog_file_path lang::catalog::get_catalog_file_path (private) lang::catalog::get_catalog_file_path->lang::util::charset_for_locale lang::conn::charset lang::conn::charset (public) lang::conn::charset->lang::util::charset_for_locale rp_filter rp_filter (private) rp_filter->lang::util::charset_for_locale xo::ConnectionContext proc require xo::ConnectionContext proc require xo::ConnectionContext proc require->lang::util::charset_for_locale

Testcases:
test_get_locales

lang::util::convert_adp_variables_to_percentage_signs (private)

 lang::util::convert_adp_variables_to_percentage_signs text

Convert ADP variables to percentage_signs - the notation used to interpolate variable values into acs-lang messages.

Parameters:
text (required)
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 test_util__convert_adp_variables_to_percentage_signs util__convert_adp_variables_to_percentage_signs (test acs-lang) lang::util::convert_adp_variables_to_percentage_signs lang::util::convert_adp_variables_to_percentage_signs test_util__convert_adp_variables_to_percentage_signs->lang::util::convert_adp_variables_to_percentage_signs template::adp_array_variable_regexp template::adp_array_variable_regexp (public) lang::util::convert_adp_variables_to_percentage_signs->template::adp_array_variable_regexp template::adp_array_variable_regexp_noquote template::adp_array_variable_regexp_noquote (public) lang::util::convert_adp_variables_to_percentage_signs->template::adp_array_variable_regexp_noquote template::adp_variable_regexp template::adp_variable_regexp (public) lang::util::convert_adp_variables_to_percentage_signs->template::adp_variable_regexp template::adp_variable_regexp_noquote template::adp_variable_regexp_noquote (public) lang::util::convert_adp_variables_to_percentage_signs->template::adp_variable_regexp_noquote lang::util::replace_temporary_tags_with_lookups lang::util::replace_temporary_tags_with_lookups (public) lang::util::replace_temporary_tags_with_lookups->lang::util::convert_adp_variables_to_percentage_signs

Testcases:
util__convert_adp_variables_to_percentage_signs

lang::util::convert_percentage_signs_to_adp_variables (private)

 lang::util::convert_percentage_signs_to_adp_variables text

Convert percentage_signs message vars to adp var syntax.

Parameters:
text (required)
Author:
Peter Marklund
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_util__convert_adp_variables_to_percentage_signs util__convert_adp_variables_to_percentage_signs (test acs-lang) lang::util::convert_percentage_signs_to_adp_variables lang::util::convert_percentage_signs_to_adp_variables test_util__convert_adp_variables_to_percentage_signs->lang::util::convert_percentage_signs_to_adp_variables template::adp_array_variable_regexp template::adp_array_variable_regexp (public) lang::util::convert_percentage_signs_to_adp_variables->template::adp_array_variable_regexp template::adp_array_variable_regexp_noquote template::adp_array_variable_regexp_noquote (public) lang::util::convert_percentage_signs_to_adp_variables->template::adp_array_variable_regexp_noquote template::adp_variable_regexp template::adp_variable_regexp (public) lang::util::convert_percentage_signs_to_adp_variables->template::adp_variable_regexp template::adp_variable_regexp_noquote template::adp_variable_regexp_noquote (public) lang::util::convert_percentage_signs_to_adp_variables->template::adp_variable_regexp_noquote

Testcases:
util__convert_adp_variables_to_percentage_signs

lang::util::convert_to_i18n (public)

 lang::util::convert_to_i18n [ -locale locale ] \
    [ -package_key package_key ] [ -message_key message_key ] \
    [ -prefix prefix ] -text text [ -object_id object_id ]

Internationalising of Attributes. This is done by storing the attribute with its acs-lang key

Switches:
-locale (optional, defaults to "en_US")
-package_key (optional, defaults to "acs-translations")
-message_key (optional)
-prefix (optional)
-text (required)
-object_id (optional)
bind the newly created message key to this acs_object id. Upon object's deletion, the message key will be deleted as well.

Partial Call Graph (max 5 caller/called nodes):
%3 test_group_localization group_localization (test acs-subsite) lang::util::convert_to_i18n lang::util::convert_to_i18n test_group_localization->lang::util::convert_to_i18n test_lang_test__convert_to_i18n lang_test__convert_to_i18n (test acs-lang) test_lang_test__convert_to_i18n->lang::util::convert_to_i18n apm_package_id_from_key apm_package_id_from_key (public) lang::util::convert_to_i18n->apm_package_id_from_key lang::message::register lang::message::register (public) lang::util::convert_to_i18n->lang::message::register lang::util::suggest_key lang::util::suggest_key (private) lang::util::convert_to_i18n->lang::util::suggest_key Class ::xowiki::formfield::localized_text Class ::xowiki::formfield::localized_text (public) Class ::xowiki::formfield::localized_text->lang::util::convert_to_i18n group::new group::new (public) group::new->lang::util::convert_to_i18n group::update group::update (public) group::update->lang::util::convert_to_i18n subsite::after_upgrade subsite::after_upgrade (private) subsite::after_upgrade->lang::util::convert_to_i18n

Testcases:
lang_test__convert_to_i18n, group_localization

lang::util::default_locale_from_lang (public)

 lang::util::default_locale_from_lang language

Returns an enabled default locale for a language. If a language only has one locale then that locale is returned. If no locale could be found the empty string is returned.

Parameters:
language (required)
Name of a country, using ISO-3166 two letter code
Returns:
Default locale
Author:
Henry Minsky <hqm@mit.edu>

Partial Call Graph (max 5 caller/called nodes):
%3 test_default_locale_from_lang default_locale_from_lang (test acs-lang) lang::util::default_locale_from_lang lang::util::default_locale_from_lang test_default_locale_from_lang->lang::util::default_locale_from_lang lang::util::default_locale_from_lang_not_cached lang::util::default_locale_from_lang_not_cached (private) lang::util::default_locale_from_lang->lang::util::default_locale_from_lang_not_cached util_memoize util_memoize (public) lang::util::default_locale_from_lang->util_memoize category::get_name category::get_name (public) category::get_name->lang::util::default_locale_from_lang lang::conn::browser_locale lang::conn::browser_locale (private) lang::conn::browser_locale->lang::util::default_locale_from_lang lang::message::check lang::message::check (public) lang::message::check->lang::util::default_locale_from_lang lang::message::lookup lang::message::lookup (public) lang::message::lookup->lang::util::default_locale_from_lang lang::message::register lang::message::register (public) lang::message::register->lang::util::default_locale_from_lang

Testcases:
default_locale_from_lang

lang::util::default_locale_from_lang_not_cached (private)

 lang::util::default_locale_from_lang_not_cached language

Returns the default locale for a language. Not cached.

Parameters:
language (required)
Name of a language, using a two or three letter ISO code
Returns:
Default locale
Author:
Henry Minsky <hqm@mit.edu>
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 lang::util::default_locale_from_lang lang::util::default_locale_from_lang (public) lang::util::default_locale_from_lang_not_cached lang::util::default_locale_from_lang_not_cached lang::util::default_locale_from_lang->lang::util::default_locale_from_lang_not_cached ad_log ad_log (public) lang::util::default_locale_from_lang_not_cached->ad_log db_list db_list (public) lang::util::default_locale_from_lang_not_cached->db_list

Testcases:
No testcase defined.

lang::util::edit_lang_key_url (public)

 lang::util::edit_lang_key_url -message message \
    [ -package_key package_key ]

Generates the URL to edit a message key.

Switches:
-message (required)
key with or without hashes, such as \#acs-admin.Actions\# or acs-admin.Actions.
-package_key (optional, defaults to "acs-translations")
must correspond to that in the message key.
Returns:
a local URL or the empty string when no URL can be generated.

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_edit_lang_key_url test_edit_lang_key_url (test acs-lang) lang::util::edit_lang_key_url lang::util::edit_lang_key_url test_test_edit_lang_key_url->lang::util::edit_lang_key_url ad_conn ad_conn (public) lang::util::edit_lang_key_url->ad_conn ad_return_url ad_return_url (public) lang::util::edit_lang_key_url->ad_return_url apm_package_url_from_key apm_package_url_from_key (public) lang::util::edit_lang_key_url->apm_package_url_from_key export_vars export_vars (public) lang::util::edit_lang_key_url->export_vars

Testcases:
test_edit_lang_key_url

lang::util::escape_vars_if_not_null (private)

 lang::util::escape_vars_if_not_null list

Processes a list of variables before they are passed into a regexp command.

Parameters:
list (required)
List of variable names

Partial Call Graph (max 5 caller/called nodes):
%3 lc_parse_number lc_parse_number (public) lang::util::escape_vars_if_not_null lang::util::escape_vars_if_not_null lc_parse_number->lang::util::escape_vars_if_not_null

Testcases:
No testcase defined.

lang::util::get_hash_indices (public)

 lang::util::get_hash_indices multilingual_string

Returns a list of two element lists containing the start and end indices of a #message_key# match in the multilingual string. This proc is used by the localize proc.

Parameters:
multilingual_string (required)
Author:
Peter marklund <peter@collaboraid.biz>

Partial Call Graph (max 5 caller/called nodes):
%3 test_util__get_hash_indices util__get_hash_indices (test acs-lang) lang::util::get_hash_indices lang::util::get_hash_indices test_util__get_hash_indices->lang::util::get_hash_indices lang::util::localize lang::util::localize (public) lang::util::localize->lang::util::get_hash_indices packages/acs-admin/www/apm/version-i18n.tcl packages/acs-admin/ www/apm/version-i18n.tcl packages/acs-admin/www/apm/version-i18n.tcl->lang::util::get_hash_indices

Testcases:
util__get_hash_indices

lang::util::get_label (public)

 lang::util::get_label locale

Returns the label (name) of locale

Parameters:
locale (required)
Code for the locale, eg "en_US"
Returns:
String containing the label for the locale
Author:
Bruno Mattarollo <bruno.mattarollo@ams.greenpeace.org>

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_get_locales test_get_locales (test acs-lang) lang::util::get_label lang::util::get_label test_test_get_locales->lang::util::get_label db_string db_string (public) lang::util::get_label->db_string packages/acs-lang/www/admin/batch-editor.tcl packages/acs-lang/ www/admin/batch-editor.tcl packages/acs-lang/www/admin/batch-editor.tcl->lang::util::get_label packages/acs-lang/www/admin/edit-description.tcl packages/acs-lang/ www/admin/edit-description.tcl packages/acs-lang/www/admin/edit-description.tcl->lang::util::get_label packages/acs-lang/www/admin/edit-localized-message.tcl packages/acs-lang/ www/admin/edit-localized-message.tcl packages/acs-lang/www/admin/edit-localized-message.tcl->lang::util::get_label packages/acs-lang/www/admin/export-locale-to-files.tcl packages/acs-lang/ www/admin/export-locale-to-files.tcl packages/acs-lang/www/admin/export-locale-to-files.tcl->lang::util::get_label packages/acs-lang/www/admin/import-locale-from-files.tcl packages/acs-lang/ www/admin/import-locale-from-files.tcl packages/acs-lang/www/admin/import-locale-from-files.tcl->lang::util::get_label

Testcases:
test_get_locales

lang::util::get_locale_options (public)

 lang::util::get_locale_options

Return a list of locales know to the system

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_get_locales test_get_locales (test acs-lang) lang::util::get_locale_options lang::util::get_locale_options test_test_get_locales->lang::util::get_locale_options lang::util::get_locale_options_not_cached lang::util::get_locale_options_not_cached (private) lang::util::get_locale_options->lang::util::get_locale_options_not_cached util_memoize util_memoize (public) lang::util::get_locale_options->util_memoize

Testcases:
test_get_locales

lang::util::get_locale_options_not_cached (private)

 lang::util::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):
%3 lang::util::get_locale_options lang::util::get_locale_options (public) lang::util::get_locale_options_not_cached lang::util::get_locale_options_not_cached lang::util::get_locale_options->lang::util::get_locale_options_not_cached db_list_of_lists db_list_of_lists (public) lang::util::get_locale_options_not_cached->db_list_of_lists

Testcases:
No testcase defined.

lang::util::get_message_lookups (private)

 lang::util::get_message_lookups

Get the list of all message keys looked up so far during the current request.

Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 packages/acs-lang/lib/messages-to-translate.tcl packages/acs-lang/ lib/messages-to-translate.tcl lang::util::get_message_lookups lang::util::get_message_lookups packages/acs-lang/lib/messages-to-translate.tcl->lang::util::get_message_lookups

Testcases:
No testcase defined.

lang::util::get_regexp_indices (private)

 lang::util::get_regexp_indices multilingual_string regexp_pattern

Returns a list of two element lists containing the start and end indices of what is captured by the first parenthesis in the given regexp pattern in the multilingual string. The regexp pattern must follow the syntax of the expression argument to the Tcl regexp command. It must also contain exactly one capturing parenthesis for the pieces of text that indices are to be returned for.

Parameters:
multilingual_string (required)
regexp_pattern (required)
Author:
Peter marklund <peter@collaboraid.biz>
See Also:
  • get_hash_indices

Partial Call Graph (max 5 caller/called nodes):
%3 lang::util::get_temporary_tags_indices lang::util::get_temporary_tags_indices (public) lang::util::get_regexp_indices lang::util::get_regexp_indices lang::util::get_temporary_tags_indices->lang::util::get_regexp_indices

Testcases:
No testcase defined.

lang::util::get_temporary_tags_indices (public)

 lang::util::get_temporary_tags_indices adp_file_string

Given the contents of an adp file return the indices of the start and end chars of embedded message keys on the syntax: <#package_key.message_key Some en_US text#>

Parameters:
adp_file_string (required)
Author:
Peter marklund <peter@collaboraid.biz>

Partial Call Graph (max 5 caller/called nodes):
%3 test_util__replace_temporary_tags_with_lookups util__replace_temporary_tags_with_lookups (test acs-lang) lang::util::get_temporary_tags_indices lang::util::get_temporary_tags_indices test_util__replace_temporary_tags_with_lookups->lang::util::get_temporary_tags_indices lang::util::get_regexp_indices lang::util::get_regexp_indices (private) lang::util::get_temporary_tags_indices->lang::util::get_regexp_indices lang::util::message_tag_regexp lang::util::message_tag_regexp (public) lang::util::get_temporary_tags_indices->lang::util::message_tag_regexp lang::util::replace_temporary_tags_with_lookups lang::util::replace_temporary_tags_with_lookups (public) lang::util::replace_temporary_tags_with_lookups->lang::util::get_temporary_tags_indices packages/acs-admin/www/apm/version-i18n.tcl packages/acs-admin/ www/apm/version-i18n.tcl packages/acs-admin/www/apm/version-i18n.tcl->lang::util::get_temporary_tags_indices

Testcases:
util__replace_temporary_tags_with_lookups

lang::util::iso6392_from_language (public)

 lang::util::iso6392_from_language -language language

Returns the ISO-639-2 code for a language.

Switches:
-language (required)
Language, using ISO-639 code (2 or 3 chars)
Returns:
The ISO-639-2 terminology code for the language

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_get_locales test_get_locales (test acs-lang) lang::util::iso6392_from_language lang::util::iso6392_from_language test_test_get_locales->lang::util::iso6392_from_language db_string db_string (public) lang::util::iso6392_from_language->db_string lang::conn::language lang::conn::language (public) lang::conn::language->lang::util::iso6392_from_language lang::system::language lang::system::language (public) lang::system::language->lang::util::iso6392_from_language lang::user::language lang::user::language (public) lang::user::language->lang::util::iso6392_from_language lang::util::iso6392_from_locale lang::util::iso6392_from_locale (public) lang::util::iso6392_from_locale->lang::util::iso6392_from_language

Testcases:
test_get_locales

lang::util::iso6392_from_locale (public)

 lang::util::iso6392_from_locale -locale locale

Returns the ISO-639-2 code for a locale.

Switches:
-locale (required)
Locale to get the language ISO-639-2 code for
Returns:
The ISO-639-2 language code for the locale

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_get_locales test_get_locales (test acs-lang) lang::util::iso6392_from_locale lang::util::iso6392_from_locale test_test_get_locales->lang::util::iso6392_from_locale lang::util::iso6392_from_language lang::util::iso6392_from_language (public) lang::util::iso6392_from_locale->lang::util::iso6392_from_language

Testcases:
test_get_locales

lang::util::lang_sort (public, deprecated)

 lang::util::lang_sort field [ locale ]
Deprecated. Invoking this procedure generates a warning.

Each locale can have a different alphabetical sort order. You can test this proc with the following data:

    insert into lang_testsort values ('lama');
    insert into lang_testsort values ('lhasa');
    insert into lang_testsort values ('llama');
    insert into lang_testsort values ('lzim');
    
DEPRECATED: this api only supports Oracle. It also uses hardcoded mapping between language and collation. It is unclear if an api is needed for this, or if one can just have database-specific SQL in xql files in order to achieve cross-db collation behavior.

Parameters:
field (required)
Name of Oracle column
locale (optional)
Locale for sorting. If locale is unspecified just return the column name
Returns:
Language aware version of field for Oracle ORDER BY clause.
Author:
Jeff Davis <davis@xarg.net>
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 ad_log_deprecated ad_log_deprecated (public) lang::util::lang_sort lang::util::lang_sort lang::util::lang_sort->ad_log_deprecated

Testcases:
No testcase defined.

lang::util::language_label (public)

 lang::util::language_label -language language

Returns the ISO-639 label for a language code.

Switches:
-language (required)
Language, using ISO-639 code (2 or 3 chars)
Returns:
The ISO-639 label for the language

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_get_locales test_get_locales (test acs-lang) lang::util::language_label lang::util::language_label test_test_get_locales->lang::util::language_label db_string db_string (public) lang::util::language_label->db_string packages/acs-lang/www/admin/locale-new.tcl packages/acs-lang/ www/admin/locale-new.tcl packages/acs-lang/www/admin/locale-new.tcl->lang::util::language_label

Testcases:
test_get_locales

lang::util::localize (public)

 lang::util::localize string_with_hashes [ locale ]

Takes a string with embedded message keys on the format #message_key_name# and returns the same string but with the message keys (and their surrounding hash marks) replaced with the corresponding value in the message catalog. Message lookup is done with the locale of the request. If message lookup fails for a certain key then a translation missing message will be used instead.

Parameters:
string_with_hashes (required)
locale (optional)
Author:
Peter marklund <peter@collaboraid.biz>

Partial Call Graph (max 5 caller/called nodes):
%3 test_ad_context_bar_multirow ad_context_bar_multirow (test acs-tcl) lang::util::localize lang::util::localize test_ad_context_bar_multirow->lang::util::localize test_lang_test__lang_user_site_wide_locale lang_test__lang_user_site_wide_locale (test acs-lang) test_lang_test__lang_user_site_wide_locale->lang::util::localize test_localize localize (test acs-lang) test_localize->lang::util::localize test_object_type_hierarchy object_type_hierarchy (test acs-tcl) test_object_type_hierarchy->lang::util::localize test_test_localize_list_of_lists test_localize_list_of_lists (test acs-lang) test_test_localize_list_of_lists->lang::util::localize ad_conn ad_conn (public) lang::util::localize->ad_conn lang::message::lookup lang::message::lookup (public) lang::util::localize->lang::message::lookup lang::util::get_hash_indices lang::util::get_hash_indices (public) lang::util::localize->lang::util::get_hash_indices Class ::cookieconsent::CookieConsent Class ::cookieconsent::CookieConsent (public) Class ::cookieconsent::CookieConsent->lang::util::localize Class ::xo::lti::LTI Class ::xo::lti::LTI (public) Class ::xo::lti::LTI->lang::util::localize Class ::xowf::test_item::Answer_manager Class ::xowf::test_item::Answer_manager (public) Class ::xowf::test_item::Answer_manager->lang::util::localize Class ::xowiki::formfield::localized_text Class ::xowiki::formfield::localized_text (public) Class ::xowiki::formfield::localized_text->lang::util::localize acs_object_type_hierarchy acs_object_type_hierarchy (public) acs_object_type_hierarchy->lang::util::localize

Testcases:
lang_test__lang_user_site_wide_locale, localize, test_localize_list_of_lists, ad_context_bar_multirow, object_type_hierarchy

lang::util::localize_list_of_lists (public)

 lang::util::localize_list_of_lists [ -list list ]

localize the elements of a list_of_lists

Switches:
-list (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_localize_list_of_lists test_localize_list_of_lists (test acs-lang) lang::util::localize_list_of_lists lang::util::localize_list_of_lists test_test_localize_list_of_lists->lang::util::localize_list_of_lists lang::util::localize lang::util::localize (public) lang::util::localize_list_of_lists->lang::util::localize template::data::transform::party_search template::data::transform::party_search (private) template::data::transform::party_search->lang::util::localize_list_of_lists

Testcases:
test_localize_list_of_lists

lang::util::message_key_regexp (public)

 lang::util::message_key_regexp

Regular expression for recognizing message keys in the form #package_name.key#.

See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_message_regexp test_message_regexp (test acs-lang) lang::util::message_key_regexp lang::util::message_key_regexp test_test_message_regexp->lang::util::message_key_regexp Class ::xowiki::formfield::localized_text Class ::xowiki::formfield::localized_text (public) Class ::xowiki::formfield::localized_text->lang::util::message_key_regexp Class ::xowiki::includelet::folders Class ::xowiki::includelet::folders (public) Class ::xowiki::includelet::folders->lang::util::message_key_regexp group::new group::new (public) group::new->lang::util::message_key_regexp

Testcases:
test_message_regexp

lang::util::message_tag_regexp (public)

 lang::util::message_tag_regexp

The regexp expression used by proc get_temporary_tags_indices and elsewhere to extract temporary message catalog tags (<#...#>) from ADP and Tcl files. The first sub match of the expression is the whole tag, the second sub match is the message key, and the third sub match is the message text in en_US locale.

Author:
Peter marklund <peter@collaboraid.biz>
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_message_regexp test_message_regexp (test acs-lang) lang::util::message_tag_regexp lang::util::message_tag_regexp test_test_message_regexp->lang::util::message_tag_regexp lang::util::get_temporary_tags_indices lang::util::get_temporary_tags_indices (public) lang::util::get_temporary_tags_indices->lang::util::message_tag_regexp lang::util::replace_temporary_tags_with_lookups lang::util::replace_temporary_tags_with_lookups (public) lang::util::replace_temporary_tags_with_lookups->lang::util::message_tag_regexp

Testcases:
test_message_regexp

lang::util::nls_language_from_language (public)

 lang::util::nls_language_from_language language

Returns the nls_language name for a language

Parameters:
language (required)
Name of a country, using ISO-3166 two letter code
Returns:
The nls_language name of the language.
Author:
Henry Minsky <hqm@mit.edu>

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_get_locales test_get_locales (test acs-lang) lang::util::nls_language_from_language lang::util::nls_language_from_language test_test_get_locales->lang::util::nls_language_from_language db_string db_string (public) lang::util::nls_language_from_language->db_string packages/acs-templating/tcl/spellcheck-init.tcl packages/acs-templating/ tcl/spellcheck-init.tcl packages/acs-templating/tcl/spellcheck-init.tcl->lang::util::nls_language_from_language

Testcases:
test_get_locales

lang::util::record_message_lookup (private)

 lang::util::record_message_lookup message_key

Record a message lookup in translator mode. In translator mode we collect all message lookups at the bottom of the page for translation.

Parameters:
message_key (required)
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 lang::message::lookup lang::message::lookup (public) lang::util::record_message_lookup lang::util::record_message_lookup lang::message::lookup->lang::util::record_message_lookup ad_conn ad_conn (public) lang::util::record_message_lookup->ad_conn

Testcases:
No testcase defined.

lang::util::remove_gt_lt (private)

 lang::util::remove_gt_lt s

Removes < > and replaces them with &lt &gt;

Parameters:
s (required)

Partial Call Graph (max 5 caller/called nodes):
%3 lang::util::replace_adp_text_with_message_tags lang::util::replace_adp_text_with_message_tags (public) lang::util::remove_gt_lt lang::util::remove_gt_lt lang::util::replace_adp_text_with_message_tags->lang::util::remove_gt_lt

Testcases:
No testcase defined.

lang::util::replace_adp_text_with_message_tags (public)

 lang::util::replace_adp_text_with_message_tags file_name mode [ keys ]

Prepares an .adp-file for localization by inserting temporary hash-tags around text strings that looks like unlocalized plain text. Needless to say this is a little shaky so not all plain text is caught and the script may insert hash-tags around stuff that should not be localized. It is conservative though. There are two modes the script can be run in: - report : do *not* write changes to the file but return a report with suggested changes. - write : write changes in the file - it expects a list of keys and will insert them in the order implied by the report - a report is also returned.

Parameters:
file_name (required)
The name of the adp file to do replacements in.
mode (required)
Either report or write.
keys (optional)
A list of keys to use for the texts that may be provided in write mode. If the keys are not provided then autogenerated keys will be used. If a supplied key is the empty string this indicates that the corresponding text should be left untouched.
Returns:
The report is list of two lists: The first being a list of pairs (key, text with context) and the second is a list of suspious looking garbage. In report mode the keys are suggested keys and in write mode the keys are the keys supplied in the keys parameter.
Authors:
Christian Hvid
Peter Marklund
Jeff Davis

Partial Call Graph (max 5 caller/called nodes):
%3 test_util__replace_adp_text_with_message_tags util__replace_adp_text_with_message_tags (test acs-lang) lang::util::replace_adp_text_with_message_tags lang::util::replace_adp_text_with_message_tags test_util__replace_adp_text_with_message_tags->lang::util::replace_adp_text_with_message_tags lang::util::remove_gt_lt lang::util::remove_gt_lt (private) lang::util::replace_adp_text_with_message_tags->lang::util::remove_gt_lt lang::util::suggest_key lang::util::suggest_key (private) lang::util::replace_adp_text_with_message_tags->lang::util::suggest_key template::adp_array_variable_regexp template::adp_array_variable_regexp (public) lang::util::replace_adp_text_with_message_tags->template::adp_array_variable_regexp template::adp_array_variable_regexp_noquote template::adp_array_variable_regexp_noquote (public) lang::util::replace_adp_text_with_message_tags->template::adp_array_variable_regexp_noquote template::adp_variable_regexp template::adp_variable_regexp (public) lang::util::replace_adp_text_with_message_tags->template::adp_variable_regexp packages/acs-admin/www/apm/version-i18n-process-2.tcl packages/acs-admin/ www/apm/version-i18n-process-2.tcl packages/acs-admin/www/apm/version-i18n-process-2.tcl->lang::util::replace_adp_text_with_message_tags packages/acs-admin/www/apm/version-i18n-process.tcl packages/acs-admin/ www/apm/version-i18n-process.tcl packages/acs-admin/www/apm/version-i18n-process.tcl->lang::util::replace_adp_text_with_message_tags packages/acs-admin/www/apm/version-i18n.tcl packages/acs-admin/ www/apm/version-i18n.tcl packages/acs-admin/www/apm/version-i18n.tcl->lang::util::replace_adp_text_with_message_tags

Testcases:
util__replace_adp_text_with_message_tags

lang::util::replace_temporary_tags_with_lookups (public)

 lang::util::replace_temporary_tags_with_lookups file_list

Modify the given ADP or Tcl files by replacing occurencies of message keys with message lookups (i.e. #package_key.message_key# for ADP files and [_ "package_key.message_key"] for Tcl files) and create entries in the catalog file for each of these keys. If the short hand form <#_ Some en_US text#> is used then the key will be auto-generated based on the text. Returns the number of replacements done. This procedure only reads from and writes to the catalog file specified (the en_US catalog file per default) of the package that the files belong to, the database is not accessed in any way.

Parameters:
file_list (required)
A list of paths to .adp or .tcl files to do replacements in. The paths should be relative to $::acs::rootdir. All files must belong to the same package.
Author:
Peter marklund <peter@collaboraid.biz>

Partial Call Graph (max 5 caller/called nodes):
%3 test_util__replace_temporary_tags_with_lookups util__replace_temporary_tags_with_lookups (test acs-lang) lang::util::replace_temporary_tags_with_lookups lang::util::replace_temporary_tags_with_lookups test_util__replace_temporary_tags_with_lookups->lang::util::replace_temporary_tags_with_lookups lang::catalog::export lang::catalog::export (public) lang::util::replace_temporary_tags_with_lookups->lang::catalog::export lang::catalog::get_catalog_file_path lang::catalog::get_catalog_file_path (private) lang::util::replace_temporary_tags_with_lookups->lang::catalog::get_catalog_file_path lang::catalog::parse lang::catalog::parse (private) lang::util::replace_temporary_tags_with_lookups->lang::catalog::parse lang::catalog::read_file lang::catalog::read_file (private) lang::util::replace_temporary_tags_with_lookups->lang::catalog::read_file lang::message::register lang::message::register (public) lang::util::replace_temporary_tags_with_lookups->lang::message::register packages/acs-admin/www/apm/version-i18n-process-2.tcl packages/acs-admin/ www/apm/version-i18n-process-2.tcl packages/acs-admin/www/apm/version-i18n-process-2.tcl->lang::util::replace_temporary_tags_with_lookups

Testcases:
util__replace_temporary_tags_with_lookups

lang::util::suggest_key (private)

 lang::util::suggest_key text

Suggest a key for given text.

Parameters:
text (required)

Partial Call Graph (max 5 caller/called nodes):
%3 lang::util::convert_to_i18n lang::util::convert_to_i18n (public) lang::util::suggest_key lang::util::suggest_key lang::util::convert_to_i18n->lang::util::suggest_key lang::util::replace_adp_text_with_message_tags lang::util::replace_adp_text_with_message_tags (public) lang::util::replace_adp_text_with_message_tags->lang::util::suggest_key lang::util::replace_temporary_tags_with_lookups lang::util::replace_temporary_tags_with_lookups (public) lang::util::replace_temporary_tags_with_lookups->lang::util::suggest_key

Testcases:
No testcase defined.

lang::util::translator_mode_p (public)

 lang::util::translator_mode_p

Whether translator mode is enabled for this session or not. Translator mode will cause all non-translated messages to appear as a link to a page where the message can be translated, instead of the default "not translated" message.

Returns:
1 if translator mode is enabled, 0 otherwise. Returns 0 if there is no HTTP connection.
Author:
Lars Pind <lars@collaboraid.biz>
Created:
October 24, 2002
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_translator_mode test_translator_mode (test acs-lang) lang::util::translator_mode_p lang::util::translator_mode_p test_test_translator_mode->lang::util::translator_mode_p ad_get_client_property ad_get_client_property (public) lang::util::translator_mode_p->ad_get_client_property Class ::xowiki::formfield::FormField Class ::xowiki::formfield::FormField (public) Class ::xowiki::formfield::FormField->lang::util::translator_mode_p adp_parse_ad_conn_file adp_parse_ad_conn_file (private) adp_parse_ad_conn_file->lang::util::translator_mode_p lang::message::lookup lang::message::lookup (public) lang::message::lookup->lang::util::translator_mode_p packages/acs-bootstrap-installer/installer/www/blank-master.tcl packages/acs-bootstrap-installer/ installer/www/blank-master.tcl packages/acs-bootstrap-installer/installer/www/blank-master.tcl->lang::util::translator_mode_p packages/acs-developer-support/lib/toolbar.tcl packages/acs-developer-support/ lib/toolbar.tcl packages/acs-developer-support/lib/toolbar.tcl->lang::util::translator_mode_p

Testcases:
test_translator_mode

lang::util::translator_mode_set (public)

 lang::util::translator_mode_set translator_mode_p

Sets whether translator mode is enabled for this session or not.

Parameters:
translator_mode_p (required)
1 if you want translator mode to be enabled, 0 otherwise.
Author:
Lars Pind <lars@collaboraid.biz>
Created:
October 24, 2002
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_translator_mode test_translator_mode (test acs-lang) lang::util::translator_mode_set lang::util::translator_mode_set test_test_translator_mode->lang::util::translator_mode_set ad_set_client_property ad_set_client_property (public) lang::util::translator_mode_set->ad_set_client_property packages/acs-lang/www/admin/translator-mode-toggle.tcl packages/acs-lang/ www/admin/translator-mode-toggle.tcl packages/acs-lang/www/admin/translator-mode-toggle.tcl->lang::util::translator_mode_set

Testcases:
test_translator_mode
[ show source ]