lang::message::format (public)

 lang::message::format localized_message [ value_array_list ] \
    [ upvar_level ]

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

Substitute all occurencies of %array_key% in the given localized message with the value from a lookup in the value_array_list with array_key (what's between the percentage sings). If value_array_list is not provided then attempt to fetch variable values the number of levels up given by upvar_level (defaults to 3 because this proc is typically invoked from the underscore lookup proc). Here is an example: set localized_message "The %animal% jumped across the %barrier%. About 50% of the time, he stumbled, or maybe it was %%20 %times%." set value_list { animal "frog" barrier "fence" } ns_log notice formatted=[format $localized_message $value_list] The output from the example is: The frog jumped across the fence. About 50% of the time, he stumbled, or maybe it was %20 %times%.

Parameters:
localized_message (required)
value_array_list (optional)
upvar_level (optional, defaults to "3")

Partial Call Graph (max 5 caller/called nodes):
%3 test_message__format message__format (test acs-lang) lang::message::format lang::message::format test_message__format->lang::message::format ad_log ad_log (public) lang::message::format->ad_log lang::message::embedded_vars_regexp lang::message::embedded_vars_regexp (public) lang::message::format->lang::message::embedded_vars_regexp lang::message::lookup lang::message::lookup (public) lang::message::lookup->lang::message::format

Testcases:
message__format
[ show source ]
Show another procedure: