Skip to content

Commit

Permalink
Merge pull request #1006 from ramiy/issue/1005
Browse files Browse the repository at this point in the history
Issue/1005 - i18n improvements
  • Loading branch information
Devin Walker committed Sep 8, 2016
2 parents a00a879 + d3d71a2 commit cf500a7
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 38 deletions.
25 changes: 14 additions & 11 deletions includes/admin/dashboard-widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,29 @@ function give_dashboard_sales_widget() {
<div class="give-dashboard-widget">

<div class="give-dashboard-today give-clearfix">
<h3 class="give-dashboard-date-today"><?php echo date( 'F j, Y' ); ?></h3>
<h3 class="give-dashboard-date-today"><?php echo date( _x( 'F j, Y', 'dashboard widget', 'give' ) ); ?></h3>

<p class="give-dashboard-happy-day"><?php
printf(
/* translators: %s: day of the week */
esc_html__( 'Happy %s!', 'give' ),
date( 'l', current_time( 'timestamp' ) )
);
?></p>
?></p>

<?php $earnings_today = $stats->get_earnings( 0, 'today', false ); ?>

<p class="give-dashboard-today-earnings"><?php echo give_currency_filter( give_format_amount( $earnings_today ) ); ?></p>

<p class="give-orders-today">
<?php $donations_today = $stats->get_sales( 0, 'today', false ); ?>
<?php echo give_format_amount( $donations_today, false ); ?>
<span><?php echo _x( 'donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give' ); ?></span>
</p>
<p class="give-dashboard-today-earnings"><?php
$earnings_today = $stats->get_earnings( 0, 'today', false );
echo give_currency_filter( give_format_amount( $earnings_today ) );
?></p>

<p class="give-orders-today"><?php
$donations_today = $stats->get_sales( 0, 'today', false );
printf(
/* translators: %s: daily donation count */
esc_html__( '%s donations today', 'give' ),
give_format_amount( $donations_today, false )
);
?></p>

</div>

Expand Down
2 changes: 1 addition & 1 deletion includes/admin/forms/dashboard-columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function give_render_form_columns( $column_name, $post_id ) {
if ( ! empty( $goal_option ) && $goal_option === 'yes' ) {
echo give_goal( $post_id, false );
} else {
echo esc_html__( 'No Goal Set', 'give' );
esc_html_e( 'No Goal Set', 'give' );
}

echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />';
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/payments/view-order-details.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@
<?php
$var_prices = give_has_variable_prices( $payment_meta['form_id'] );
if ( empty( $var_prices ) ) {
echo esc_html__( 'n/a', 'give' );
esc_html_e( 'n/a', 'give' );
} else {
// Variable price dropdown options.
$variable_price_dropdown_option = array(
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/shortcodes/shortcode-give-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function define_fields() {
'placeholder' => esc_attr__( '- Select a Form -', 'give' ),
'required' => array(
'alert' => esc_html__( 'You must first select a Form!', 'give' ),
'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms found.', 'give' ), $create_form_link ),
'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ),
),
),
array(
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/shortcodes/shortcode-give-goal.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function define_fields() {
'placeholder' => esc_attr__( '- Select a Form -', 'give' ),
'required' => array(
'alert' => esc_html__( 'You must first select a Form!', 'give' ),
'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms found.', 'give' ), $create_form_link ),
'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ),
),
),
array(
Expand Down
6 changes: 3 additions & 3 deletions includes/ajax-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function give_ajax_form_search() {

$items[] = array(
'id' => 0,
'name' => esc_html__( 'No results found', 'give' )
'name' => esc_html__( 'No forms found.', 'give' )
);

}
Expand Down Expand Up @@ -302,7 +302,7 @@ function give_ajax_donor_search() {

$donors[] = array(
'id' => 0,
'name' => esc_html__( 'No results found', 'give' )
'name' => esc_html__( 'No donors found.', 'give' )
);

}
Expand Down Expand Up @@ -349,7 +349,7 @@ function give_ajax_search_users() {
$user_list .= '<li><a href="#" data-userid="' . esc_attr( $user->ID ) . '" data-login="' . esc_attr( $user->user_login ) . '">' . esc_html( $user->user_login ) . '</a></li>';
}
} else {
$user_list .= '<li>' . esc_html__( 'No users found', 'give' ) . '</li>';
$user_list .= '<li>' . esc_html__( 'No users found.', 'give' ) . '</li>';
}
$user_list .= '</ul>';

Expand Down
2 changes: 1 addition & 1 deletion includes/api/class-give-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ public function get_stats( $args = array() ) {
} else {
$error['error'] = sprintf(
/* translators: %s: form */
esc_html__( 'Product %s not found.', 'give' ),
esc_html__( 'Form %s not found.', 'give' ),
$args['form']
);
}
Expand Down
10 changes: 5 additions & 5 deletions includes/class-give-cli-commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function forms( $args, $assoc_args ) {
return;
} elseif ( empty( $forms['forms'] ) ) {

WP_CLI::error( __( 'No form found.', 'give' ) );
WP_CLI::error( __( 'No forms found.', 'give' ) );
return;
}

Expand Down Expand Up @@ -241,7 +241,7 @@ public function forms( $args, $assoc_args ) {
$is_table_first_row_set = false;
$table_column_count = 0;

WP_CLI::line( $this->color_message( sprintf( __( '%1$d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) );
WP_CLI::line( $this->color_message( sprintf( __( '%d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) );

foreach ( $forms['forms'] as $index => $form_data ) {

Expand Down Expand Up @@ -402,7 +402,7 @@ public function donors( $args, $assoc_args ) {
}

if ( empty( $donors ) ) {
WP_CLI::error( __( 'No donors found', 'give' ) );
WP_CLI::error( __( 'No donors found.', 'give' ) );
return;
}

Expand Down Expand Up @@ -514,14 +514,14 @@ public function donations( $args, $assoc_args ) {
}

if ( empty( $donations ) ) {
WP_CLI::error( __( 'No sales found', 'give' ) );
WP_CLI::error( __( 'No donations found.', 'give' ) );
return;
}

self::$counter = 1;

foreach ( $donations['donations'] as $key => $donation ) {
$this->color_main_heading( sprintf( __( '%1$s. Payment #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' );
$this->color_main_heading( sprintf( __( '%1$s. Donation #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' );
self::$counter++;

foreach ( $donation as $column => $data ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/class-give-html-elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function forms_dropdown( $args = array() ) {
$options[ absint( $form->ID ) ] = esc_html( $form->post_title );
}
} else {
$options[0] = esc_html__( 'No donation forms found.', 'give' );
$options[0] = esc_html__( 'No forms found.', 'give' );
}

// This ensures that any selected forms are included in the drop down
Expand Down
6 changes: 3 additions & 3 deletions includes/forms/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
//Set Price, No Custom Amount Allowed means hidden price field
if ( $allow_custom_amount == 'no' ) {
?>
<label class="give-hidden" for="give-amount-hidden"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label>
<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" value="<?php echo $default_amount; ?>" required>
<div class="set-price give-donation-amount form-row-wide">
<?php if ( $currency_position == 'before' ) {
Expand All @@ -413,7 +413,7 @@ function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
<?php if ( $currency_position == 'before' ) {
echo $currency_output;
} ?>
<label class="give-hidden" for="give-amount"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label>
<label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
<?php if ( $currency_position == 'after' ) {
echo $currency_output;
Expand Down Expand Up @@ -1693,7 +1693,7 @@ function give_test_mode_frontend_warning() {
$test_mode = give_get_option( 'test_mode' );

if ( $test_mode == 'on' ) {
echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice', 'give' ) . '</strong>: ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>';
echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>';
}
}

Expand Down
8 changes: 4 additions & 4 deletions includes/post-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ function give_setup_post_types() {
'all_items' => esc_html__( 'All Forms', 'give' ),
'view_item' => esc_html__( 'View Form', 'give' ),
'search_items' => esc_html__( 'Search Forms', 'give' ),
'not_found' => esc_html__( 'No forms found', 'give' ),
'not_found_in_trash' => esc_html__( 'No forms found in Trash', 'give' ),
'not_found' => esc_html__( 'No forms found.', 'give' ),
'not_found_in_trash' => esc_html__( 'No forms found in Trash.', 'give' ),
'parent_item_colon' => '',
'menu_name' => apply_filters( 'give_menu_name', esc_html__( 'Donations', 'give' ) ),
'name_admin_bar' => apply_filters( 'give_name_admin_bar_name', esc_html__( 'Donation Form', 'give' ) )
Expand Down Expand Up @@ -103,8 +103,8 @@ function give_setup_post_types() {
'all_items' => esc_html__( 'All Donations', 'give' ),
'view_item' => esc_html__( 'View Donation', 'give' ),
'search_items' => esc_html__( 'Search Donations', 'give' ),
'not_found' => esc_html__( 'No Donations Found', 'give' ),
'not_found_in_trash' => esc_html__( 'No Donations found in Trash', 'give' ),
'not_found' => esc_html__( 'No donations found.', 'give' ),
'not_found_in_trash' => esc_html__( 'No donations found in Trash.', 'give' ),
'parent_item_colon' => '',
'menu_name' => esc_html__( 'Donations', 'give' )
);
Expand Down
14 changes: 8 additions & 6 deletions tests/unit-tests/tests-post-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ public function test_give_post_type_labels() {
$this->assertEquals( 'Add Form', $wp_post_types['give_forms']->labels->add_new );
$this->assertEquals( 'Add New Donation Form', $wp_post_types['give_forms']->labels->add_new_item );
$this->assertEquals( 'Edit Donation Form', $wp_post_types['give_forms']->labels->edit_item );
$this->assertEquals( 'New Form', $wp_post_types['give_forms']->labels->new_item );
$this->assertEquals( 'All Forms', $wp_post_types['give_forms']->labels->all_items );
$this->assertEquals( 'View Form', $wp_post_types['give_forms']->labels->view_item );
$this->assertEquals( 'Search Forms', $wp_post_types['give_forms']->labels->search_items );
$this->assertEquals( 'No forms found', $wp_post_types['give_forms']->labels->not_found );
$this->assertEquals( 'No forms found in Trash', $wp_post_types['give_forms']->labels->not_found_in_trash );
$this->assertEquals( 'All Forms', $wp_post_types['give_forms']->labels->all_items );
$this->assertEquals( 'No forms found.', $wp_post_types['give_forms']->labels->not_found );
$this->assertEquals( 'No forms found in Trash.', $wp_post_types['give_forms']->labels->not_found_in_trash );
$this->assertEquals( 'Donations', $wp_post_types['give_forms']->labels->menu_name );
$this->assertEquals( 'Donation Form', $wp_post_types['give_forms']->labels->name_admin_bar );
$this->assertEquals( 1, $wp_post_types['give_forms']->publicly_queryable );
Expand Down Expand Up @@ -65,11 +66,12 @@ public function test_payment_post_type_labels() {
$this->assertEquals( 'Add New', $wp_post_types['give_payment']->labels->add_new );
$this->assertEquals( 'Add New Donation', $wp_post_types['give_payment']->labels->add_new_item );
$this->assertEquals( 'Edit Donation', $wp_post_types['give_payment']->labels->edit_item );
$this->assertEquals( 'New Donation', $wp_post_types['give_payment']->labels->new_item );
$this->assertEquals( 'All Donations', $wp_post_types['give_payment']->labels->all_items );
$this->assertEquals( 'View Donation', $wp_post_types['give_payment']->labels->view_item );
$this->assertEquals( 'Search Donations', $wp_post_types['give_payment']->labels->search_items );
$this->assertEquals( 'No Donations Found', $wp_post_types['give_payment']->labels->not_found );
$this->assertEquals( 'No Donations found in Trash', $wp_post_types['give_payment']->labels->not_found_in_trash );
$this->assertEquals( 'All Donations', $wp_post_types['give_payment']->labels->all_items );
$this->assertEquals( 'No donations found.', $wp_post_types['give_payment']->labels->not_found );
$this->assertEquals( 'No donations found in Trash.', $wp_post_types['give_payment']->labels->not_found_in_trash );
$this->assertEquals( 'Donations', $wp_post_types['give_payment']->labels->menu_name );
$this->assertEquals( 'Donation', $wp_post_types['give_payment']->labels->name_admin_bar );
$this->assertEquals( '', $wp_post_types['give_payment']->publicly_queryable );
Expand Down

0 comments on commit cf500a7

Please sign in to comment.