Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate stripe error messages during payment processing #8405

Conversation

jibees
Copy link
Contributor

@jibees jibees commented Oct 25, 2021

What? Why?

Closes #7961
Stripe error messages aren't translated.

But, Stripe send us an error code: use it (if found it and translation key does exist) to translated the error message
Populate the en.yml file with some of the most known errors

What should we test?

Test that stripe error messages (with different card number: https://stripe.com/docs/testing#cards-responses):

  • are well translated if the i18n key is present (ie. the errors are translated for the current langage)
  • use the default message coming from stripe if the i18n key is not present (ie. english)

Release notes

Add translation for Stripe errors

Changelog Category: User facing changes

@jibees jibees changed the title Translate some error messages during payment processing if exists Translate stripe error messages during payment processing Oct 25, 2021
Copy link
Member

@mkllnk mkllnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. 😎

config/locales/en.yml Outdated Show resolved Hide resolved
@jibees jibees force-pushed the 7961-translate-stripe-error-message branch from d4d2379 to 99e9660 Compare November 5, 2021 15:37
app/models/spree/payment/processing.rb Outdated Show resolved Hide resolved
- Stripe error messages aren't translated. But, Stripe send the error code. Use it (if found it, and translation key does exist) to translated the error message
 - Populate the en.yml file with some of the most known errors

Co-Authored-By: Matt-Yorkley <[email protected]>
@jibees jibees force-pushed the 7961-translate-stripe-error-message branch from 99e9660 to 7041ec7 Compare November 11, 2021 11:05
@jibees jibees requested a review from mkllnk November 12, 2021 08:56
@filipefurtad0 filipefurtad0 self-assigned this Nov 15, 2021
@filipefurtad0 filipefurtad0 added the pr-staged-uk staging.openfoodnetwork.org.uk label Nov 15, 2021
@filipefurtad0
Copy link
Contributor

filipefurtad0 commented Nov 15, 2021

Hey @jibees ,

To stage this PR it was proceeded as follows:

  • staged the PR
  • logged in to the server via ssh
  • manually added the translations with nano config/locales/fr_CA.yml : To make this visible a label FR... was added to each string.
  • re-started puma.service
  • logged into the app as customer, selecting fr_CA locale.
  • triggered some of the error messages added by this PR

As an example, here is the error message for expired_card, card 4000000000000069:
image

This works 🎉

I've found there are still some cases which are not covered by the added keys, like insufficient_funds, card 4000008260003178 (3D-auth):

image

Or in the UI itself:
image

But these can be addressed in separate PRs 👍
I'll investigate and open additional issues if needed.

Good to go.

@filipefurtad0 filipefurtad0 removed the pr-staged-uk staging.openfoodnetwork.org.uk label Nov 15, 2021
@RachL
Copy link
Contributor

RachL commented Nov 15, 2021

wow now I understand why users are unable to tell us what went wrong with their payments! If they see messages like for insufficient funds in English... 🤦

@jibees
Copy link
Contributor Author

jibees commented Nov 15, 2021

Thanks @filipefurtad0 : feel free to open two separates issues for those two cases, they aren't the same I guess, but I'd be happy to tackle them ;)

@filipefurtad0
Copy link
Contributor

Here they are @jibees #8489 and #8488.

@Matt-Yorkley Matt-Yorkley merged commit 0efa370 into openfoodfoundation:master Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide a locale to Stripe Elements requests to enable messages to be translated
5 participants