Skip to content

Allow locale to be specified by the developer. #650

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

Open
michelle opened this issue Nov 7, 2017 · 18 comments · Fixed by #656
Open

Allow locale to be specified by the developer. #650

michelle opened this issue Nov 7, 2017 · 18 comments · Fixed by #656
Labels
Future Candidate Feature Has Pull Request i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response.

Comments

@michelle
Copy link

michelle commented Nov 7, 2017

It would be helpful for merchants to be able to specify the locale that the user agent displays the payment sheet in.

Especially as we're discussing custom error messages, which are merchant-supplied, it is really awkward if the message the merchant supplies doesn't match the language (and amount / currency display) in the sheet.

An additional data point we have from Stripe Checkout is that localization only helps conversion if the merchant page and the payment modal are displayed in the same locale.

@michelle
Copy link
Author

michelle commented Nov 7, 2017

@rsolomakhin
Copy link
Collaborator

The locale should pass on to the payment handler as well. @frank-hoffmann

@marcoscaceres
Copy link
Member

marcoscaceres commented Nov 16, 2017

I spoke with our implementation team about this, and although receptive to the idea, this wouldn't be high priority for Mozilla to implement. We are planning to do a staged rollout of localized payment sheets over the next year(s), so we could eventually support this... but it would take time.

I'm still happy to add it to the spec tho, because I can see how this would be clearly useful for a consistent shopping experience.

Thoughts from other implementers? Defer this to after CR? @michelle, what priority would you give this from Stripe's perspective?

CC @molly26dalton for input

@michelle
Copy link
Author

michelle commented Nov 16, 2017

We definitely understand that it would take time!

However, even if not all browsers are able to support all locales right away, allowing the merchant specify the preferred locale would still be a worthy addition to the CR from Stripe's perspective. Having a single language through the payment flow has, in our experience, increased conversion.

I also imagine that this feature would be a good complement to #647 (and a potential alternative solution for #327), as it would be confusing if the error message and display item language do not match the payment sheet language.

@ianbjacobs
Copy link
Collaborator

From previous conversations I thought that we decided that language would be determined by preferences from the user agent (e.g., through HTTP headers). Is that not sufficient?

Ian

@marcoscaceres
Copy link
Member

It’s insufficient: language is usually set by users explicitly on the site (think of how annoying it is when you go overseas and your favourite search engine suddenly changes language on you... want to avoid that kind of experience).

@marc-roberts-jg
Copy link

Needs to take into consideration that users in places like Canada may have set their preferred language in the site, when the language can't be detected automatically because of the country.

@marcoscaceres
Copy link
Member

Exactly the above. Further, any expat will tell you the same thing: just because you live in a country doesn’t mean you speak - or, given the choice, prefer - that country’s language.

I’ll try to draft a PR for this soon.

@rsolomakhin
Copy link
Collaborator

I'm OK implementing support for this parameter in PaymentRequest API, but our UI architecture currently allows for only one language at a time. It would take us a while to implement full support for this, but there's nothing technical that fundamentally stops us from doing it eventually.

@marcoscaceres
Copy link
Member

Yeah, I think we should only pass in one language tag. Then we can use "lookup" to derive a suitable match.

@marcoscaceres marcoscaceres added CR-Exit i18n-needs-resolution Issue the Internationalization Group has raised and looks for a response on. and removed Future Candidate Feature labels Nov 17, 2017
@marcoscaceres
Copy link
Member

Cc'ing @r12a for i18n comment/tracking... not sure which label to use ☺️

@r12a r12a added i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. and removed i18n-needs-resolution Issue the Internationalization Group has raised and looks for a response on. labels Nov 17, 2017
@mnoorenberghe
Copy link
Member

I spoke with our implementation team about this, and although receptive to the idea, this wouldn't be high priority for Mozilla to implement. We are planing to do a staged rollout of localized payment sheets over the next year(s), so we could eventually support this... but it would take time.

To clarify, we have a similar problem to what @rsolomakhin mentions… that we currently only ship one language pack per build by default. Then we'll have to deal with reading from multiple at a time. Currently our fallbacks for untranslated strings are done at build time, not runtime.

Having a single language through the payment flow has, in our experience, increased conversion.

Was this experience with using a native payment UI that's not embedded in the webpage? I think the value of this will come down to whether users think of the Payment Request UI as part of the webpage or as part of the browser. There are some cases where users may want their UA language to be used, not the page language, for example, if I'm not fluent in the supported languages of the merchant site, having the PR UI in my preferred language will be easier for me to use/understand.

@michelle
Copy link
Author

Was this experience with using a native payment UI that's not embedded in the webpage?

This experience was from Stripe Checkout, which is more similar to the payment sheet than to the merchant's website: https://stripe.com/checkout

There are some cases where users may want their UA language to be used, not the page language, for example, if I'm not fluent in the supported languages of the merchant site, having the PR UI in my preferred language will be easier for me to use/understand.

That is definitely plausible, though I think if possible, we should gather end user data to test this hypothesis. The merchant is supplying display items, labels, and (eventually) error message in the language(s) they support. Having two different languages shown in the sheet is potentially also confusing.

marcoscaceres added a commit that referenced this issue Nov 24, 2017
* Adds "lang" member to PaymentRequestInit dictionary
* Adds processing model for `lang`
* Optionally allows UA to localize the payment sheet

closes #650
@marcoscaceres
Copy link
Member

Just noting that I sent a PR for this a little while ago, but hasn't been reviewed yet. Could interested folks take a look: #656

@domenic
Copy link
Collaborator

domenic commented Jan 19, 2018

Would it suffice to just use the language specified by the merchant for their entire page? E.g. if their page does , then having any calls to paymentRequest.show() show the UI in Belarusian? That seems a bit cleaner than having to add a new API that is specifically designed to let PaymentRequest get out of sync with the rest of the page.

marcoscaceres added a commit that referenced this issue Jan 23, 2018
* Adds "lang" member to PaymentRequestInit dictionary
* Adds processing model for `lang`
* Optionally allows UA to localize the payment sheet

closes #650
@stpeter
Copy link

stpeter commented Jan 24, 2018

The Accept-Language HTTP header might also be communicated from the user's browser to the merchant website. See https://www.w3.org/International/questions/qa-when-lang-neg regarding use of this header for language negotiation. For example, the hint that the merchant sends could be constrained to one of the languages that is in the Accept-Language set. See also https://www.w3.org/International/wiki/Locale-based_forms for related discussion regarding number and date formats (which could be important for payment totals and ship dates). [Sorry, I added this comment at the PR but it belongs here so that the i18n WG can track it more easily.]

@marcoscaceres
Copy link
Member

Speaking out loud here: the merchant will have the Accept-Language header by default, which in turn will allow them to set the language of the body element (this is generally applicable i18n guidance for any website). Additionally, setting the language through a user-configurable option i in the site itself is usually a better solution... alternatively, some sites also use Geo IP solutions, which can be annoying, but mostly "good enough".

As @domenic suggests, it feels like the right thing to do here is for us just recommend the payment sheet use the document language. Let's see how we go with that for, say, 1-2 years. If we find that it's insufficient, then let's add the API part... we have the text ready to go when we need it 😇

I'll make the appropriate changes to #656.

marcoscaceres added a commit that referenced this issue Jan 29, 2018
* Adds "lang" member to PaymentRequestInit dictionary
* Adds processing model for `lang`
* Optionally allows UA to localize the payment sheet

closes #650
@marcoscaceres
Copy link
Member

Marking as future candidate feature. After review from the i18n folks, decided to defer this to after we go to REC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Future Candidate Feature Has Pull Request i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants