Commit 95c5b4cd authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

V6.2.1: Fix variable substitutions in translated error/warning messages shown to the user

Fixes #32
parent 3fb163d4
......@@ -2,7 +2,7 @@ BASE=rules_shipping
BASE_ADV=rules_shipping_advanced
PLUGINTYPE=vmshipment
ZIPBASE=opentools_vm
VERSION=6.2
VERSION=6.2.1
PLUGINFILES=$(BASE).php $(BASE)_base.php $(BASE)_framework_joomla.php $(BASE).script.php $(BASE).xml index.html
PLUGINFILES_ADV=$(BASE_ADV).php $(BASE)_base.php $(BASE)_framework_joomla.php $(BASE_ADV).script.php $(BASE_ADV).xml index.html
......
......@@ -653,7 +653,7 @@ class ShippingRule {
var $countries = array();
var $ruleinfo = 0;
var $includes_tax = 0;
var $messages = array('error' => array(), 'warning' => array(), 'notice' => array(), 'debug' => array());
var $messages = array('error' => array(), 'warning' => array(), 'message' => array(), 'notice' => array(), 'debug' => array());
function __construct ($framework, $rule, $countries, $ruleinfo) {
$this->framework = $framework;
......@@ -687,8 +687,8 @@ class ShippingRule {
case 'comment': break; // Completely ignore all comments!
case 'error': $this->messages['error'][] = $value; break;
case 'warning': $this->messages['warning'][] = $value; break;
case 'notice':
case 'message': $this->messages['notice'][] = $value; break;
case 'notice': $this->messages['notice'][] = $value; break;
case 'message': $this->messages['message'][] = $value; break;
case 'debug': $this->messages['debug'][] = $value; break;
case 'condition': $this->conditions[] = $value; break;
default: $this->framework->warning('OTSHIPMENT_RULES_UNKNOWN_VARIABLE', $var, $rulepart);
......@@ -1136,7 +1136,8 @@ class ShippingRule {
$this->match = True;
foreach ($this->messages as $k=>$msgs) {
foreach ($msgs as $i=>$m) {
$this->messages[$k][$i] = $this->stringReplaceVariables($m, $vals);
// First translate the messge before replacing variables!
$this->messages[$k][$i] = $this->stringReplaceVariables($this->framework->__($m), $vals);
}
}
// Calculate the value (i.e. shipping cost or modifier)
......
......@@ -6,7 +6,7 @@
<authorUrl>http://www.open-tools.net</authorUrl>
<copyright>Copyright (C) 2013-2014, Reinhold Kainhofer</copyright>
<license>GPL v3+</license>
<version>6.2</version>
<version>6.2.1</version>
<description>OTSHIPMENT_RULES_DESC</description>
<files>
<filename plugin="rules_shipping">rules_shipping.php</filename>
......
......@@ -6,7 +6,7 @@
<authorUrl>http://www.open-tools.net</authorUrl>
<copyright>Copyright (C) 2013-2014, Reinhold Kainhofer</copyright>
<license>GPL v3+</license>
<version>6.2</version>
<version>6.2.1</version>
<description>OTSHIPMENT_RULES_ADV_DESC</description>
<files>
<filename plugin="rules_shipping_advanced">rules_shipping_advanced.php</filename>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment