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 ]

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

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
Source code:

    # If the package acs-translations is installed do the conversion
    # magic, otherwise just return the text again.

    if {[apm_package_id_from_key acs-translations]} {
    if {$message_key eq ""} {
        if {$prefix eq ""} {
        # Having no prefix or message_key is discouraged as it
        # might have interesting side effects due to double
        # meanings of the same english string in multiple contexts
        # but for the time being we should still allow this.
        set message_key [lang::util::suggest_key $text]
        } else {
        set message_key "${prefix}_[lang::util::suggest_key $text]"
        }
    }

    # Register the language keys
        lang::message::register  -object_id $object_id  $locale $package_key $message_key $text

    return "#${package_key}.${message_key}#"
    } else {
    return "$text"
    }
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-lang/tcl/lang-util-procs.xql

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