woothemes/woocommerce — pull request #5333 by ragulka (2014-04-17 11:00:50+00:00)
Title: Introduce `woocommerce_order_status_name` filter

Whenever order status was displayed, the name was translated using `__()`.
However, the translation domain was always `woocommerce`. This means that
custom statuses added by 3rd party plugins/themes were never translated.
This filter allows developers to override the status name with their own translation.

A use case is as follows: a plugin author adds a new custom order status and calls it 'unconfirmed'. A shop owner has a shop, that's in Germany. The shop owner sees the status name in the order screen in admin as "unconfrmed" - in english, although it should be translated. The same happens when a custome ris viewing her recent orders - all other information is translated, but the order status is "unconfirmed" - again, untranslated.

This happens because of `__( $status->name, 'woocommerce' )`. Sure, WooCommerce knows about the built-in status names, but a 3rd party developer cannot add his custom status name translation to WooCommerce translations. He needs to supply it himself.

Using `apply_filters( 'woocommerce_order_status_name', __( $status->name, 'woocommerce' ), $status )` he can hook into the filter, look at the status and return the appropriate translation. Example:

```php
function my_status_name( $name, $status ) {
if ($status->slug == 'unconfirmed')
$name = __( $status->name, 'my-plugin-domain' );
return $name;
}
add_filter( 'woocommerce_order_status_name', 'my_status_name', 10, 2 );
```