Not translatable (solution)
-
The plugin is not translatable as it’s using ‘woocommerce’ domain instead it’s own domain. Additionally JS text is not ready for translation.
In order to do it I’ve modified the following code in the plugin that the author could add to solve the issue. Once that’s done I can also provide the author the Spanish translation.File “wac-cart-update.php”:
$resp['update_label'] = __( 'Update Cart', 'woocommerce' ); $resp['checkout_label'] = __( 'Proceed to Checkout', 'woocommerce' );
must be
$resp['update_label'] = __( 'Update Cart', 'woocommerce-ajax-cart' ); $resp['checkout_label'] = __( 'Proceed to Checkout', 'woocommerce-ajax-cart' );
(or the desired domain like “wooajaxcart”).
File “wac-js-calls.php”:
After// enqueue js wp_enqueue_script('wooajaxcart', plugins_url('wooajaxcart.js', WAC_PLUGIN));
the following code must be added
// Localize the script with new data $translation_array = array( 'updating_text' => __( 'Updating...', 'woocommerce-ajax-cart' ), 'warn_remove_text' => __( 'Are you sure you want to remove this item from cart?', 'woocommerce-ajax-cart' ) ); wp_localize_script( 'wooajaxcart', 'wooajaxcart_localization', $translation_array );
.
File “wooajaxcart.js”:
$("input[name='update_cart']").val('Updating...').prop('disabled', true); $("a.checkout-button.wc-forward").addClass('disabled').html('Updating...');
and
if ( !confirm('Are you sure you want to remove this item from cart?') ) {
must be$("input[name='update_cart']").val(wooajaxcart_localization.updating_text).prop('disabled', true); $("a.checkout-button.wc-forward").addClass('disabled').html(wooajaxcart_localization.updating_text);
and
if ( !confirm(wooajaxcart_localization.warn_remove_text) ) {
Regards.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Not translatable (solution)’ is closed to new replies.