?%2$s',
esc_attr( $text ),
esc_html( $text )
);
}
/**
* One-line description of an unusual week.
*
* @param array $a Anomaly from Insights::anomalies().
* @return string
*/
function statbird_anomaly_text( array $a ) {
$pct = number_format_i18n( abs( $a['change'] ), 0 ) . '%';
$down = $a['change'] < 0;
switch ( $a['metric'] ) {
case 'revenue':
/* translators: %s: percentage. */
return sprintf( $down ? __( 'Revenue was %s below usual last week.', 'statbird' ) : __( 'Revenue was %s above usual last week.', 'statbird' ), $pct );
case 'orders':
/* translators: %s: percentage. */
return sprintf( $down ? __( 'Orders were %s below usual last week.', 'statbird' ) : __( 'Orders were %s above usual last week.', 'statbird' ), $pct );
case 'new_customers':
/* translators: %s: percentage. */
return sprintf( $down ? __( 'New customers were %s below usual last week.', 'statbird' ) : __( 'New customers were %s above usual last week.', 'statbird' ), $pct );
default:
/* translators: %s: percentage. */
return sprintf( $down ? __( 'Orders from returning customers were %s below usual last week.', 'statbird' ) : __( 'Orders from returning customers were %s above usual last week.', 'statbird' ), $pct );
}
}