[interchange] Allow passing params to error tag, which are replaced (same functionality as [warnings]). Useful for

Josh Lavin <[email protected]>
Newsgroups gmane.comp.web.interchange.cvs
Message-ID <[email protected]>
commit bd39e2c6ceea6f1d2f97cee4283406777544f616
Author: Josh Lavin <[email protected]>
Date:   Wed Jul 3 13:44:00 2013 -0700

    Allow passing params to error tag, which are replaced (same functionality as [warnings]). Useful for localization.
    
    Example:
    	[error
    		name=username
    		set="That was a bad username. Please contact us at %s or %s."
    		param.0="(800) 555-1212"
    		param.1="(512) 555-1212"
    	]

 code/SystemTag/error.coretag |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/code/SystemTag/error.coretag b/code/SystemTag/error.coretag
index 18e4adb..c120470 100644
--- a/code/SystemTag/error.coretag
+++ b/code/SystemTag/error.coretag
@@ -37,6 +37,10 @@ sub tag_error {
 	if($opt->{set}) {
 		$opt->{keep} = 1 unless defined $opt->{keep};
 		my $error = delete $opt->{set};
+		if($opt->{param}) {
+			$opt->{param} = [ $opt->{param} ] unless ref($opt->{param} );
+			$error = sprintf($error, @{$opt->{param}});
+		}
 		return set_error($error, $var, $opt);
 	}
 	my $err_ref = $Vend::Session->{errors};
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.