Merge pull request #815 from GeertDD/i18n_sales_dashboard_widget

Made the monthly sales dashboard widget translatable
This commit is contained in:
Mike Jolley 2012-03-15 18:47:15 -07:00
commit b26bdca131
3 changed files with 11 additions and 9 deletions

View File

@ -184,10 +184,10 @@ function woocommerce_init_dashboard_widgets() {
$sales_heading = '';
if ($the_month_num!=date('m')) :
$sales_heading .= '<a href="index.php?month='.($current_month_offset+1).'" class="next">'.date('F', strtotime('01-'.($the_month_num+1).'-2011')).' &rarr;</a>';
$sales_heading .= '<a href="index.php?month='.($current_month_offset+1).'" class="next">'.date_i18n('F', strtotime('01-'.($the_month_num+1).'-2011')).' &rarr;</a>';
endif;
$sales_heading .= '<a href="index.php?month='.($current_month_offset-1).'" class="previous">&larr; '.date('F', strtotime('01-'.($the_month_num-1).'-2011')).'</a><span>'.__('Monthly Sales', 'woocommerce').'</span>';
$sales_heading .= '<a href="index.php?month='.($current_month_offset-1).'" class="previous">&larr; '.date_i18n('F', strtotime('01-'.($the_month_num-1).'-2011')).'</a><span>'.__('Monthly Sales', 'woocommerce').'</span>';
if(current_user_can('manage_woocommerce_orders')){
wp_add_dashboard_widget( 'woocommerce_dashboard_right_now', __( 'WooCommerce Right Now', 'woocommerce' ), 'woocommerce_dashboard_widget_right_now' );
@ -388,8 +388,10 @@ function woocommerce_dashboard_sales_js() {
remove_filter( 'posts_where', 'orders_this_month' );
/* Script variables */
$params = array(
'currency_symbol' => get_woocommerce_currency_symbol()
$params = array(
'currency_symbol' => get_woocommerce_currency_symbol(),
'number_of_sales' => __( 'Number of sales', 'woocommerce' ),
'sales_amount' => __( 'Sales aumount', 'woocommerce' ),
);
$order_counts_array = array();

View File

@ -1143,7 +1143,7 @@ function woocommerce_product_sales() {
$orders_link = admin_url('edit.php?s&post_status=all&post_type=shop_order&action=-1&s=' . urlencode(get_the_title($chosen_product_id)) . '&m=' . date('Ym', strtotime($date.'01')) . '&shop_order_status=completed,processing,on-hold');
echo '<tr><th><a href="'.$orders_link.'">'.date('F', strtotime($date.'01')).'</a></th>
echo '<tr><th><a href="'.$orders_link.'">'.date_i18n('F', strtotime($date.'01')).'</a></th>
<td width="1%"><span>'.$sales.'</span><span class="alt">'.woocommerce_price($product_totals[$date]).'</span></td>
<td class="bars">
<span style="width:'.$width.'%">&nbsp;</span>

View File

@ -29,7 +29,7 @@ jQuery(function(){
var placeholder = jQuery("#placeholder");
var plot = jQuery.plot(placeholder, [ { label: "Number of sales", data: d }, { label: "Sales amount", data: d2, yaxis: 2 } ], {
var plot = jQuery.plot(placeholder, [ { label: params.number_of_sales, data: d }, { label: params.sales_amount, data: d2, yaxis: 2 } ], {
series: {
lines: { show: true },
points: { show: true }
@ -77,15 +77,15 @@ jQuery(function(){
jQuery("#tooltip").remove();
if (item.series.label=="Number of sales") {
if (item.series.label==params.number_of_sales) {
var y = item.datapoint[1];
showTooltip(item.pageX, item.pageY, item.series.label + " - " + y);
showTooltip(item.pageX, item.pageY, item.series.label + ": " + y);
} else {
var y = item.datapoint[1].toFixed(2);
showTooltip(item.pageX, item.pageY, item.series.label + " - " + params.currency_symbol + y);
showTooltip(item.pageX, item.pageY, item.series.label + ": " + params.currency_symbol + y);
}