Title: Translating error messages
Last modified: August 21, 2016

---

# Translating error messages

 *  Resolved [katalonian](https://wordpress.org/support/users/katalonian/)
 * (@katalonian)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/translating-error-messages/)
 * Hi there!
    First of all, thanks for a great plugin!
 * I want to translate error messages for checkout. I found in stripe_gateway.php
   some text which i can translate, but seems to be error messages incoming straight
   from stripe’s web site. Is there is a way to localize them? Thank a lot!
 * [https://wordpress.org/plugins/striper/](https://wordpress.org/plugins/striper/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Benetan](https://wordpress.org/support/users/benetan/)
 * (@benetan)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/translating-error-messages/#post-4922352)
 * Same for me. Is there a way to do it ?
 * Thank you !
 *  Plugin Author [mgiulio](https://wordpress.org/support/users/giuliom/)
 * (@giuliom)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/translating-error-messages/#post-4922353)
 * Hi,
 * this feature is on the TODO list, maybe for the next release.
 * Cheers,
    Giulio.
 *  [Alchimix](https://wordpress.org/support/users/alchimix/)
 * (@alchimix)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/translating-error-messages/#post-4922355)
 * Hey there,
 * I’ve found a solution : modify templates/payment.php.
    Find the line with the
   condition ‘if (response.error)’ then add some custom error messages :
 *     ```
       var errorMessages = {
       	  incorrect_number: "<?php _e( 'The card number is incorrect.', 'striper' ); ?>",
       	  invalid_number: "<?php _e( 'The card number is not a valid credit card number.', 'striper' ); ?>",
       	  invalid_expiry_month: "<?php _e( "The card's expiration month is invalid.", "striper" ); ?>",
       	  invalid_expiry_year: "<?php _e( "The card's expiration year is invalid.", "striper" ); ?>",
       	  invalid_cvc: "<?php _e( "The card's security code is invalid.", "striper" ); ?>",
       	  expired_card: "<?php _e( "The card has expired.", "striper" ); ?>",
       	  incorrect_cvc: "<?php _e( "The card's security code is incorrect.", "striper" ); ?>",
       	  incorrect_zip: "The card's zip code failed validation.",
       	  card_declined: "<?php _e( "The card was declined.", "striper" ); ?>",
       	  missing: "There is no card on a customer that is being charged.",
       	  processing_error: "<?php _e( "An error occurred while processing the card", "striper" ); ?>.",
       	  rate_limit:  "An error occurred due to requests hitting the API too quickly. Please let us know if you're consistently running into this error."
       	};
       ```
   
 * You will notice I use the _e() function to register variables in WPML so they
   are translatable after this with string translations.
 * Then replace this line :
    `$form.find('.payment-errors').text(response.error.
   message);`
 * With:
    `$form.find('.payment-errors').text(errorMessages[response.error.code]);`
 * That’s all 🙂
 * Cheers !

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Translating error messages’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/striper.svg)
 * [Striper - Stripe Integration for WooCommerce](https://wordpress.org/plugins/striper/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/striper/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/striper/)
 * [Active Topics](https://wordpress.org/support/plugin/striper/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/striper/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/striper/reviews/)

## Tags

 * [Localization](https://wordpress.org/support/topic-tag/localization/)

 * 3 replies
 * 4 participants
 * Last reply from: [Alchimix](https://wordpress.org/support/users/alchimix/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/translating-error-messages/#post-4922355)
 * Status: resolved