Skip to content

Update the Specification for Locale Validation - #345

Open
darwinlyang wants to merge 5 commits into
w3c:mainfrom
darwinlyang:main
Open

darwinlyang wants to merge 5 commits into
w3c:mainfrom
darwinlyang:main

Conversation

@darwinlyang

@darwinlyang darwinlyang commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

The goal is to update the specification so that the locale field in SecurePaymentConfirmationRequest will return an error when PaymentRequest.canMakePayment() is called if:

  • the locale field is set and non-empty
  • none of the locales provided match the locale used by the Secure Payment Confirmation dialog

See #343 for additional discussions for this PR.


Preview | Diff

Comment thread spec.bs
Comment thread spec.bs Outdated
Comment thread spec.bs Outdated
Comment thread spec.bs
[=list/is not empty=]
[=list/is not empty=]:

1. Let |dialogLanguageTag| be the [=language tag=] used by the Secure

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure this is the right definition, but I leave this one to our i18n folks to be sure. (Maybe it should be "the language tag that the user agent will present the Secure Payment Confirmation dialog in"? Maybe we should be allowing for a list of tags?)

Comment thread spec.bs
Comment thread spec.bs Outdated
Comment thread spec.bs
Comment thread spec.bs
are an [=ASCII case-insensitive=] match, set |matched| to true and
break.

1. If |matched| is false, throw a "{{NotSupportedError}}" {{DOMException}}.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we handle wildcards? See https://w3c.github.io/i18n-glossary/#dfn-language-range

I guess not since we're only allowing language tags and I think by https://www.rfc-editor.org/info/rfc5646/ anything with a * isn't a language tag?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current proposal does not allow for wildcards as en could just be used instead of en-*.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, albeit I suspect there may be good reasons that our i18n community can think of to allow them (e.g., I believe en-*-us is allowed as a wildcard setup)

@stephenmcgruer stephenmcgruer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is ok from my viewpoint, although I imagine our i18n friends will ask if we have considered applying the matching algorithms from https://datatracker.ietf.org/doc/html/rfc4647#section-3, and why we haven't chosen them if so. It may be worth expressing that reasoning as a NOTE in the spec.

@darwinlyang

Copy link
Copy Markdown
Contributor Author

I think this is ok from my viewpoint, although I imagine our i18n friends will ask if we have considered applying the matching algorithms from https://datatracker.ietf.org/doc/html/rfc4647#section-3, and why we haven't chosen them if so. It may be worth expressing that reasoning as a NOTE in the spec.

Sounds good. I added a note on why standard language negotiation isn't used.

@ianbjacobs ianbjacobs added the i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. label Sep 29, 2026
@ianbjacobs

Copy link
Copy Markdown
Collaborator

Hi @aphillips and @xfq we welcome your input on this PR!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response.

3 participants