I think that format_callback is somehow hidden in the code as there's little documentation for it, just this brief mention in commerce.api.php:
format_callback: Custom callback function to format a price value.
I think we should provide an example of usage in that file.
But first I think it's better if we modify the signature of the function commerce_currency_format, as now it's getting these parameters:
function commerce_currency_format($amount, $currency_code, $object = NULL, $convert = TRUE) {
And sending this to the format callback
return $currency['format_callback']($amount, $currency, $object);
Where $object could be basically anything known by the man, and in D7 you can't possibly know what type of entity are you dealing with just with the object/entity itself: #1042822: Developers need an $entity->entity_type property
Also, Commerce sends a view there in commerce_line_item_handler_area_line_item_summary
'total' => commerce_currency_format($total['amount'], $total['currency_code'], $this->view)
So if you're in a scenario where you need to alter the currencies, say different price formats for Euros in different countries you end up suffering a little to know if $object is a line item (type product?), an order, a view or a guinea pig from outer space :)
Probably commerce_currency_format should have a signature like this:
function commerce_currency_format($amount, $currency_code, $convert = TRUE, $entity, $entity_type, $data) {
$data being used for passing the view or whatever context is needed.
Thoughts?
Related: #1797254: Using commerce_currency_format() as a default in a currency format_callback