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")

Testcases:
message__format
[ show source ]
Show another procedure: