#Nyxi
1 messages ยท Page 1 of 1 (latest)
By "localize the stripe SDK" do you mean the error messages returned by the SDK?
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
To the best of my knowledge this isn't a feature currently. I can raise it as a feature request.
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
Right, yeah. Okay filed the feedback.
Cool!
I guess it's just https://www.php.net/manual/en/locale.acceptfromhttp.php actaully
Maybe it's so easy that I can just do it myself and hence it's not a feature worth building in
True, but if it's pretty easy then it might be a quick win too ๐
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");
Hmmm... I think you might need to access the actual HTTP ApiRequestor object. You can see it in the README where we talk about things like cURL options and SSL compatibility
https://github.com/stripe/stripe-php#ssl--tls-compatibility-issues
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 ๐
Ouch. I wonder if you could map billing address country to locale strings and programmatically loop through all customers and assign locales.
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:
- Our app supports all possible languages (it does not)
- We accept mixed language messages on our website (customer in whatever, website only supports language x or y)
Yes I agree that makes the most sense, would be the most elegant solution.
or 3: I loop and update customers each time we add a new language
That doesn't sound fun
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
Unfortunately that does seem to be the case. I would also like to see that as an optional parameter when initializing the Stripe client.