#Nyxi

1 messages ยท Page 1 of 1 (latest)

keen willowBOT
sick bluff
#

By "localize the stripe SDK" do you mean the error messages returned by the SDK?

stuck oyster
#

Yeah

#

I can probably extract the locale myself

#

but figured maybe there was a recommended approach

#

or like a switch somewhere I haven't seen

sick bluff
#

To the best of my knowledge this isn't a feature currently. I can raise it as a feature request.

stuck oyster
#

Would be cool if it could auto-parse based on the header

#

Thanks

#

And I dn't mean user-agent, I mean Accept, of course

#

the one with languages

sick bluff
#

Right, yeah. Okay filed the feedback.

stuck oyster
#

Cool!

#

Maybe it's so easy that I can just do it myself and hence it's not a feature worth building in

sick bluff
#

True, but if it's pretty easy then it might be a quick win too ๐Ÿ™‚

stuck oyster
#

I suppose yes

#

๐Ÿ˜„

#

I may be blind ,but I can't figure out where on the client I set this

#

It seems to only take a secret key as argument

#
$stripe = new \Stripe\StripeClient("sk_test_your_key");
sick bluff
stuck oyster
#

okay, and what's the parameter to set then?

#

ah wait let me inspect \Stripe\HttpClient\CurlClient();

#

yea nothing in there about locale

#

It seems the places that support it have it as parameters on objects, such as customers (preferred locale) and checkout sessions

#

Trouble is I have 200k customers without a preferred locale set ๐Ÿ˜„

sick bluff
#

Ouch. I wonder if you could map billing address country to locale strings and programmatically loop through all customers and assign locales.

stuck oyster
#

Yeah I would rather not do that. The idea was to set it on a per-request basis. Setting it on customers requires that either:

  1. Our app supports all possible languages (it does not)
  2. We accept mixed language messages on our website (customer in whatever, website only supports language x or y)
sick bluff
#

Yes I agree that makes the most sense, would be the most elegant solution.

stuck oyster
#

or 3: I loop and update customers each time we add a new language

sick bluff
#

That doesn't sound fun

stuck oyster
#

I think having it as an option on a payment/setup/subscription intent would be the best solution

#

so that that intent always returns errors in the language you expect

#

You already have the strings since Stripe.js does it, so it's just a matter of letting the SDK do it

#

But it seems like right now it's not even possible to do what I want

sick bluff
#

Unfortunately that does seem to be the case. I would also like to see that as an optional parameter when initializing the Stripe client.

stuck oyster
#

Agree

#

A global parameter; HTTP header for it (which I assume would be the underlying mechanism) would also be fine

#

Well, something to work on