Skip to content
Snippets Groups Projects
Commit ae6208a5 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Translate rule names after variable substitution, too. This allows users to...

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
parent eeb49d1f
No related branches found
No related tags found
No related merge requests found
...@@ -1136,14 +1136,14 @@ class ShippingRule { ...@@ -1136,14 +1136,14 @@ class ShippingRule {
$this->match = True; $this->match = True;
foreach ($this->messages as $k=>$msgs) { foreach ($this->messages as $k=>$msgs) {
foreach ($msgs as $i=>$m) { foreach ($msgs as $i=>$m) {
// First translate the messge before replacing variables! // 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->stringReplaceVariables($this->framework->__($m), $vals); $this->messages[$k][$i] = $this->framework->__($this->stringReplaceVariables($this->framework->__($m), $vals));
} }
} }
// Calculate the value (i.e. shipping cost or modifier) // Calculate the value (i.e. shipping cost or modifier)
$this->value = $this->calculateShipping($vals, $products, $cartvals_callback); $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) { function matches(&$vals, $products, $cartvals_callback) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment