more i18n updates (#12189)

* i18n: simpler translation strings

* i18n: simpler translation strings

* i18n: readble printf(), and moving the %s placeholder to `%s product`

* i18n: make string translatable and remove the HTML tags

* i18n: avoide using HTML tags in translatino strings

* i18n: move the colon into the translation string and use %s placeholder for the IP

* i18n: use sprintf() on field-validation translation strings, and unify those strings

* i18n: move colons into the translation strings

* i18n: use `%s` placeholder as the site name in "Powered by WooCommerce" string

* i18n: use `%s` placeholder for min and max price

* i18n: rewrite the translation strings printf()
This commit is contained in:
Rami Yushuvaev 2016-10-26 19:35:52 +03:00 committed by Claudio Sanches
parent 11689b244c
commit 0be4db2261
7 changed files with 34 additions and 26 deletions

View File

@ -196,7 +196,10 @@ class WC_Meta_Box_Order_Data {
}
if ( $ip_address = get_post_meta( $post->ID, '_customer_ip_address', true ) ) {
echo __( 'Customer IP', 'woocommerce' ) . ': <span class="woocommerce-Order-customerIP">' . esc_html( $ip_address ) . '</span>';
printf(
__( 'Customer IP: %s', 'woocommerce' ),
'<span class="woocommerce-Order-customerIP">' . esc_html( $ip_address ) . '</span>'
);
}
?></p>
@ -268,9 +271,9 @@ class WC_Meta_Box_Order_Data {
echo '<div class="address">';
if ( $order->get_formatted_billing_address() ) {
echo '<p><strong>' . __( 'Address', 'woocommerce' ) . ':</strong>' . wp_kses( $order->get_formatted_billing_address(), array( 'br' => array() ) ) . '</p>';
echo '<p><strong>' . __( 'Address:', 'woocommerce' ) . '</strong>' . wp_kses( $order->get_formatted_billing_address(), array( 'br' => array() ) ) . '</p>';
} else {
echo '<p class="none_set"><strong>' . __( 'Address', 'woocommerce' ) . ':</strong> ' . __( 'No billing address set.', 'woocommerce' ) . '</p>';
echo '<p class="none_set"><strong>' . __( 'Address:', 'woocommerce' ) . '</strong> ' . __( 'No billing address set.', 'woocommerce' ) . '</p>';
}
foreach ( self::$billing_fields as $key => $field ) {
@ -353,9 +356,9 @@ class WC_Meta_Box_Order_Data {
echo '<div class="address">';
if ( $order->get_formatted_shipping_address() ) {
echo '<p><strong>' . __( 'Address', 'woocommerce' ) . ':</strong>' . wp_kses( $order->get_formatted_shipping_address(), array( 'br' => array() ) ) . '</p>';
echo '<p><strong>' . __( 'Address:', 'woocommerce' ) . '</strong>' . wp_kses( $order->get_formatted_shipping_address(), array( 'br' => array() ) ) . '</p>';
} else {
echo '<p class="none_set"><strong>' . __( 'Address', 'woocommerce' ) . ':</strong> ' . __( 'No shipping address set.', 'woocommerce' ) . '</p>';
echo '<p class="none_set"><strong>' . __( 'Address:', 'woocommerce' ) . '</strong> ' . __( 'No shipping address set.', 'woocommerce' ) . '</p>';
}
if ( ! empty( self::$shipping_fields ) ) {
@ -373,7 +376,7 @@ class WC_Meta_Box_Order_Data {
}
if ( apply_filters( 'woocommerce_enable_order_notes_field', 'yes' == get_option( 'woocommerce_enable_order_comments', 'yes' ) ) && $post->post_excerpt ) {
echo '<p><strong>' . __( 'Customer provided note', 'woocommerce' ) . ':</strong> ' . nl2br( esc_html( $post->post_excerpt ) ) . '</p>';
echo '<p><strong>' . __( 'Customer provided note:', 'woocommerce' ) . '</strong> ' . nl2br( esc_html( $post->post_excerpt ) ) . '</p>';
}
echo '</div>';

View File

@ -661,7 +661,7 @@ class WC_Meta_Box_Product_Data {
<div class="toolbar toolbar-variations-defaults">
<div class="variations-defaults">
<strong><?php _e( 'Default form values', 'woocommerce' ); ?>: <?php echo wc_help_tip( __( 'These are the attributes that will be pre-selected on the frontend.', 'woocommerce' ) ); ?></strong>
<strong><?php _e( 'Default form values:', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'These are the attributes that will be pre-selected on the frontend.', 'woocommerce' ) ); ?></strong>
<?php
$default_attributes = maybe_unserialize( get_post_meta( $post->ID, '_default_attributes', true ) );

View File

@ -111,7 +111,7 @@ class WC_Settings_Emails extends WC_Settings_Page {
'css' => 'width:300px; height: 75px;',
'placeholder' => __( 'N/A', 'woocommerce' ),
'type' => 'textarea',
'default' => get_bloginfo( 'name', 'display' ) . ' - ' . __( 'Powered by WooCommerce', 'woocommerce' ),
'default' => sprintf( __( '%s - Powered by WooCommerce', 'woocommerce' ), get_bloginfo( 'name', 'display' ) ),
'autoload' => false,
'desc_tip' => true,
),

View File

@ -502,14 +502,14 @@ class WC_Checkout {
$this->posted[ $key ] = wc_format_phone_number( $this->posted[ $key ] );
if ( ! WC_Validation::is_phone( $this->posted[ $key ] ) ) {
wc_add_notice( '<strong>' . $field['label'] . '</strong> ' . __( 'is not a valid phone number.', 'woocommerce' ), 'error' );
wc_add_notice( sprintf( __( '%s is not a valid phone number.', 'woocommerce' ), '<strong>' . $field['label'] . '</strong>' ), 'error' );
}
break;
case 'email' :
$this->posted[ $key ] = strtolower( $this->posted[ $key ] );
if ( ! is_email( $this->posted[ $key ] ) ) {
wc_add_notice( '<strong>' . $field['label'] . '</strong> ' . __( 'is not a valid email address.', 'woocommerce' ), 'error' );
wc_add_notice( sprintf( __( '%s is not a valid email address.', 'woocommerce' ), '<strong>' . $field['label'] . '</strong>' ), 'error' );
}
break;
case 'state' :
@ -528,7 +528,7 @@ class WC_Checkout {
// Only validate if the country has specific state options
if ( ! empty( $valid_states ) && is_array( $valid_states ) && sizeof( $valid_states ) > 0 ) {
if ( ! in_array( $this->posted[ $key ], array_keys( $valid_states ) ) ) {
wc_add_notice( '<strong>' . $field['label'] . '</strong> ' . __( 'is not valid. Please enter one of the following:', 'woocommerce' ) . ' ' . implode( ', ', $valid_states ), 'error' );
wc_add_notice( sprintf( __( '%s is not valid. Please enter one of the following: %s', 'woocommerce' ), '<strong>' . $field['label'] . '</strong>', implode( ', ', $valid_states ) ), 'error' );
}
}
break;

View File

@ -120,14 +120,14 @@ class WC_Form_Handler {
$_POST[ $key ] = wc_format_phone_number( $_POST[ $key ] );
if ( ! WC_Validation::is_phone( $_POST[ $key ] ) ) {
wc_add_notice( sprintf( __( '%s is not a valid phone number.', 'woocommerce' ), $field['label'] ), 'error' );
wc_add_notice( sprintf( __( '%s is not a valid phone number.', 'woocommerce' ), '<strong>' . $field['label'] . '</strong>' ), 'error' );
}
break;
case 'email' :
$_POST[ $key ] = strtolower( $_POST[ $key ] );
if ( ! is_email( $_POST[ $key ] ) ) {
wc_add_notice( sprintf( __( '%s is not a valid email address.', 'woocommerce' ), $field['label'] ), 'error' );
wc_add_notice( sprintf( __( '%s is not a valid email address.', 'woocommerce' ), '<strong>' . $field['label'] . '</strong>' ), 'error' );
}
break;
}
@ -199,7 +199,7 @@ class WC_Form_Handler {
foreach ( $required_fields as $field_key => $field_name ) {
if ( empty( $_POST[ $field_key ] ) ) {
wc_add_notice( sprintf( __( '%s is a required field.', 'woocommerce' ), esc_html( $field_name ) ), 'error' );
wc_add_notice( sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . esc_html( $field_name ) . '</strong>' ), 'error' );
}
}

View File

@ -84,12 +84,12 @@ class WC_Widget_Layered_Nav_Filters extends WC_Widget {
if ( $min_price ) {
$link = remove_query_arg( 'min_price' );
echo '<li class="chosen"><a title="' . esc_attr__( 'Remove filter', 'woocommerce' ) . '" href="' . esc_url( $link ) . '">' . __( 'Min', 'woocommerce' ) . ' ' . wc_price( $min_price ) . '</a></li>';
echo '<li class="chosen"><a title="' . esc_attr__( 'Remove filter', 'woocommerce' ) . '" href="' . esc_url( $link ) . '">' . sprintf( __( 'Min %s', 'woocommerce' ), wc_price( $min_price ) ) . '</a></li>';
}
if ( $max_price ) {
$link = remove_query_arg( 'max_price' );
echo '<li class="chosen"><a title="' . esc_attr__( 'Remove filter', 'woocommerce' ) . '" href="' . esc_url( $link ) . '">' . __( 'Max', 'woocommerce' ) . ' ' . wc_price( $max_price ) . '</a></li>';
echo '<li class="chosen"><a title="' . esc_attr__( 'Remove filter', 'woocommerce' ) . '" href="' . esc_url( $link ) . '">' . sprintf( __( 'Max %s', 'woocommerce' ), wc_price( $max_price ) ) . '</a></li>';
}
if ( $min_rating ) {

View File

@ -23,17 +23,22 @@ if ( ! defined( 'ABSPATH' ) ) {
}
?>
<p>
<?php
echo sprintf( esc_attr__( 'Hello %1$s%2$s%3$s (not %2$s? %4$sSign out%5$s)', 'woocommerce' ), '<strong>', esc_html( $current_user->display_name ), '</strong>', '<a href="' . esc_url( wc_get_endpoint_url( 'customer-logout', '', wc_get_page_permalink( 'myaccount' ) ) ) . '">', '</a>' );
?>
</p>
<p><?php
printf(
__( 'Hello %1$s (not %1$s? <a href="%2$s">Sign out</a>)', 'woocommerce' ),
'<strong>' . esc_html( $current_user->display_name ) . '</strong>',
esc_url( wc_get_endpoint_url( 'customer-logout', '', wc_get_page_permalink( 'myaccount' ) ) )
);
?></p>
<p>
<?php
echo sprintf( esc_attr__( 'From your account dashboard you can view your %1$srecent orders%2$s, manage your %3$sshipping and billing addresses%2$s and %4$sedit your password and account details%2$s.', 'woocommerce' ), '<a href="' . esc_url( wc_get_endpoint_url( 'orders' ) ) . '">', '</a>', '<a href="' . esc_url( wc_get_endpoint_url( 'edit-address' ) ) . '">', '<a href="' . esc_url( wc_get_endpoint_url( 'edit-account' ) ) . '">' );
?>
</p>
<p><?php
printf(
__( 'From your account dashboard you can view your <a href="%1$s">recent orders</a>, manage your <a href="%2$s">shipping and billing addresses</a> and <a href="%3$s">edit your password and account details</a>.', 'woocommerce' ),
esc_url( wc_get_endpoint_url( 'orders' ) ),
esc_url( wc_get_endpoint_url( 'edit-address' ) ),
esc_url( wc_get_endpoint_url( 'edit-account' ) )
);
?></p>
<?php
/**