From ae6208a58ed8ef84b6c6fea25ed4c3f60b99788e Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer <reinhold@kainhofer.com> Date: Wed, 25 Jan 2017 00:32:49 +0100 Subject: [PATCH] Translate rule names after variable substitution, too. This allows users to collect translatable rule names in a variable and then insert it into the final rule name --- library/rules_shipping_framework.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/rules_shipping_framework.php b/library/rules_shipping_framework.php index 792e691..f7e64c8 100644 --- a/library/rules_shipping_framework.php +++ b/library/rules_shipping_framework.php @@ -1136,14 +1136,14 @@ class ShippingRule { $this->match = True; foreach ($this->messages as $k=>$msgs) { foreach ($msgs as $i=>$m) { - // First translate the messge before replacing variables! - $this->messages[$k][$i] = $this->stringReplaceVariables($this->framework->__($m), $vals); + // First translate the messge before replacing variables! Then translate once more. This allows one to collect translatable identifiers for rule names and then insert them into the rule name. These identifiers cannot include any variables, though. + $this->messages[$k][$i] = $this->framework->__($this->stringReplaceVariables($this->framework->__($m), $vals)); } } // Calculate the value (i.e. shipping cost or modifier) $this->value = $this->calculateShipping($vals, $products, $cartvals_callback); - $this->rulename = $this->stringReplaceVariables($this->framework->__($this->name), $vals); + $this->rulename = $this->framework->__($this->stringReplaceVariables($this->framework->__($this->name), $vals)); } function matches(&$vals, $products, $cartvals_callback) { -- GitLab