Add way to print variables with given precision (i.e. two digits after comma) in messages
http://open-tools.net/forum/shipping-by-rules-plugin/5321-notice-to-user.html#8126
Code (rules_shipping_framework.php):
protected function stringReplaceVariables($str, $vals) {
// Evaluate the rule name as a translatable string with variables inserted:
// Replace all {variable} tags in the name by the variables from $vals
$matches = array();
preg_match_all('/{([A-Za-z0-9_]+)}/', $str, $matches);
foreach ($matches[1] as $m) {
$val = $this->evaluateVariable($m, $vals);
if ($val !== null) {
$str = str_replace("{".$m."}", $val, $str);
}
}
return $str;
}