Localisation – Translation Function with Multiple Variables Not Working

localisation

I have a problem using translate function.

This works:

$this->__("You can contact %s by calling %s.", $name, $phone);

But this doesn't:

$this->__("You can contact %1$s by calling %2$s.", $name, $phone);

And the problem is, that I would like to translate this as: "Please call %2$s to speak to %1$s." so the order is important.

Do you have any ideas why the second example doesn't work? I would appreciate any suggestions :).

Best Answer

Magento uses PHPs vsprintf method. So instead of %1$s you'll have to use %1\$s