Skip to content

Commit 5849cfd

Browse files
committed
Add localization hint for payment sheet
* Adds "lang" member to PaymentRequestInit dictionary * Adds processing model for `lang` * Optionally allows UA to localize the payment sheet closes #650
1 parent fe1a3ca commit 5849cfd

File tree

1 file changed

+42
-3
lines changed

1 file changed

+42
-3
lines changed

index.html

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -751,8 +751,24 @@

751751
li>
752752
ol>
753753
li>
754+
<li>Let <var>uiLangvar> be null.
755+
li>
756+
<li data-link-for="PaymentDetailsInit">If
757+
<var>detailsvar>["<a>langa>"] is present:
758+
<ol>
759+
<li>If <a data-cite=
760+
"ecma-402#sec-isstructurallyvalidlanguagetag">IsStructurallyValidLanguageTaga>(<var>detailsvar>["<a>langa>"])
761+
is false, throw a <a>RangeErrora>.
762+
li>
763+
<li>Set <var>uiLangvar> to <a data-cite=
764+
"ecma-402#sec-canonicalizelanguagetag">CanonicalizeLanguageTaga>(<var>detailsvar>["<a>langa>"]).
765+
li>
766+
ol>
767+
li>
754768
<li>Let <var>requestvar> be a new <a>PaymentRequesta>.
755769
li>
770+
<li>Set <var>requestvar>.<a>[[\uiLang]]a> to <var>uiLangvar>.
771+
li>
756772
<li>Set <var>requestvar>.<a>[[\options]]a> to <var>optionsvar>.
757773
li>
758774
<li>Set <var>requestvar>.<a>[[\state]]a> to "<a>createda>".
@@ -935,8 +951,11 @@

935951
<li>
936952
<p>
937953
Otherwise, present a user interface to allow the user to interact
938-
with the <var>handlersvar>. The user agent SHOULD prioritize
939-
the preference of the user when presenting payment methods.
954+
with the <var>handlersvar>. Optionally, if
955+
<var>requestvar>.<a>[[\uiLang]]a> is not null, localize the
956+
user interface to match, as closely as possible, the language of
957+
<a>[[\uiLang]]a>. The user agent SHOULD prioritize the
958+
preference of the user when presenting payment methods.
940959
p>
941960
<p>
942961
For the <a>payment handlera> selected by the end-user, the user
@@ -1286,6 +1305,15 @@

12861305
accepts the payment request.
12871306
td>
12881307
tr>
1308+
<tr>
1309+
<td>
1310+
<dfn>[[\uiLang]]dfn>
1311+
td>
1312+
<td>
1313+
The merchant-preferred language in which to localize the UI when
1314+
<a>show()a> is called.
1315+
td>
1316+
tr>
12891317
table>
12901318
section>
12911319
section>
@@ -1575,6 +1603,7 @@

15751603
dictionary PaymentDetailsInit : PaymentDetailsBase {
15761604
DOMString id;
15771605
required PaymentItem total;
1606+
DOMString lang;
15781607
};
15791608
pre>
15801609
<aside class="note">
@@ -1586,7 +1615,17 @@

15861615
<a>PaymentDetailsBasea> dictionary, the following members are part
15871616
of the <a>PaymentDetailsInita> dictionary:
15881617
p>
1589-
<dl>
1618+
<dl data-sort="">
1619+
<dt>
1620+
<dfn>langdfn> member
1621+
dt>
1622+
<dd>
1623+
A [[!BCP47]] language tag representing the preferred language of
1624+
the financial transaction. The <a>langa> member serves as a hint
1625+
to the user agent, optionally allowing the user agent to localize
1626+
the payment UI to be in the same language as the document that made
1627+
the request for payment.
1628+
dd>
15901629
<dt>
15911630
<dfn>iddfn> member
15921631
dt>

0 commit comments

Comments
 (0)