Stripe form localization

Hello! Just bought Pro, and I’m now thinkering with the Stripe integration.

I see that the Stripe forms (for credit cards etc.) is always in english.

As far as I know, one should be able to tell Stripe to localize the forms by using the the data-locale=“US” for example.

Can I do this somewhere in the code?

The forms you see aren’t created by Stripe. They are created by s2Member.

Here’s the KB article on localizing s2Member: https://s2member.com/kb-article/translating-s2member-s2member-pro/

Alternatively, you can use the Say What? plugin, bearing in mind that the text domain is s2member and the text context is s2member-front

So, the popup forms I get when I click “Add billing method” is a s2member form?

I can translate the button text and the “remember me” in that form, but the placeholder text in the card number field will not translate. I’m using Say what plugin.

Can I translate the placeholder text?

This pop-up is generated by Stripe, try to translate by your account, maybe…

Ok, that is why I asked the original question, Stripe supports using the data-locale="" when you call the form, I was thinking maube it was possible to specify this parameter when loading the form from stripe?

@westereng, you keep saying “form,” but what do you actually mean?

There is a Stripe form, created by s2Member. There is also a popup, created by Stripe. Each requires its own solution.

I’m talking about the popup

I have probably not been very clear in what I mean. Take a look at this example from the stripe site where it is possible to
send the data-locale="" setting

<form action="/your-server-side-code" method="POST">
<script
  src="https://checkout.stripe.com/checkout.js" class="stripe-button"
  data-key="xxxx"
  data-amount="2000"
  data-name="xxx"
  data-description="2 widgets"
  data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
  data-locale="auto"
  data-currency="nok">
</script>
</form>

could I, somewhere in the s2member code, do something to send this data parameter to stripe to let it know that i want the stripe popup form in norwegian?

See this article for information on Stripe checkout languages. Norwegian is available. I would check first to see if there is a way to set the language for scripts from your site on your Stripe account, but if that isn’t available you can add data-locale="auto" to the script code to have the form appear in the User’s preferred language. It appears that no is the code for Norwegian, from the linked article.

Thank you Pat, I have checked with Stripe and you can only change the locale when you call the script.

Do you have any idea which script file I need to make the changes in?

I solved it, by edititng stripe.js (stripe.min.js), and forcing locale to “no”. It now displays the text in norwegian.

Maybe, that should be an option in the stripe setup, to force the locale?

Thanks for the help everyone, loving the power of s2member so far :slight_smile:

I’ve submitted a GitHub issue for this feature request. Stop by and add your “vote”, if you have the time.

Great, that I will do :slight_smile:

/Ronny

Hei Ronny, we also need this on our norwegian site. Can you provide more detailed instructions (where do I find the stripe.js file)?

Hi, Sorry for the late reply, you can find stripe.min.js and stripe.js in the folowing path

wp-content/plugins/s2member-pro/src/includes/separates/gateways/stripe

open stripe.min.js and search for locale, change it to ‘no’, there should be 2 occurences

that should work, it did here :slight_smile:

Ok thank’s Ronny. I changed it from “auto” to “no” on both occurences in the file stripe.min.js but it still says “Add kr xxx”. I expected it to be “Betal kr xxx”

Hm, I wonder if I also had to translate the button texts via the locotranslate wordpress plugin.

I see the form fields are translated. Try locotranslate and search for Add. I translated it to ‘Legg til’ and it works here.