Allow translating Strip error messages.

Created on 2 April 2021, about 3 years ago
Updated 12 September 2023, 10 months ago

Problem/Motivation

Right now whenever an error is returned from Stripe it is printed as it is via Drupal.theme.commerceStripeError() function, this prevents to translate the errors if the page is multilingual.

Steps to reproduce

Set up the module and go to the card form and put a wrong formatted CC number (or any other error in the form).

The error will be in English and cannot be translated.

Proposed resolution

Use the Drupal.t() function in the message.

Basically, change this line:

  return $('<div class="messages messages--error"></div>').html(message);

To this line:

  return $('<div class="messages messages--error"></div>').html(Drupal.t(message));

Patch in my next comment.

Thanks!

πŸ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡²πŸ‡½Mexico gnuget Puebla

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024