From edfd7f5f2b9684d4620bbb4c95627a0359edeb5b Mon Sep 17 00:00:00 2001 From: Geert De Deckere Date: Thu, 15 Mar 2012 15:02:38 +0100 Subject: [PATCH 1/2] Made the monthly sales dashboard widget translatable --- admin/woocommerce-admin-dashboard.php | 10 ++++++---- assets/js/admin/dashboard_sales.js | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/admin/woocommerce-admin-dashboard.php b/admin/woocommerce-admin-dashboard.php index 8218e9dc9f6..7bbb66db9cf 100644 --- a/admin/woocommerce-admin-dashboard.php +++ b/admin/woocommerce-admin-dashboard.php @@ -184,10 +184,10 @@ function woocommerce_init_dashboard_widgets() { $sales_heading = ''; if ($the_month_num!=date('m')) : - $sales_heading .= ''; + $sales_heading .= ''; endif; - $sales_heading .= ''.__('Monthly Sales', 'woocommerce').''; + $sales_heading .= ''.__('Monthly Sales', 'woocommerce').''; 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(); diff --git a/assets/js/admin/dashboard_sales.js b/assets/js/admin/dashboard_sales.js index bc799ff7168..467681cc523 100644 --- a/assets/js/admin/dashboard_sales.js +++ b/assets/js/admin/dashboard_sales.js @@ -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); } From cb66c3116e28d6372f48aaca5d651d5c10d049d9 Mon Sep 17 00:00:00 2001 From: Geert De Deckere Date: Thu, 15 Mar 2012 15:54:44 +0100 Subject: [PATCH 2/2] One more translatable month --- admin/woocommerce-admin-reports.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/woocommerce-admin-reports.php b/admin/woocommerce-admin-reports.php index 085abb7d082..e0ee2490a01 100644 --- a/admin/woocommerce-admin-reports.php +++ b/admin/woocommerce-admin-reports.php @@ -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 ''.date('F', strtotime($date.'01')).' + echo ''.date_i18n('F', strtotime($date.'01')).' '.$sales.''.woocommerce_price($product_totals[$date]).'