forked from romulocintra/user-locale-client-hints
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
1248 lines (1147 loc) · 72.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html><html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>User Locale Preferences</title>
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
<link href="https://www.w3.org/StyleSheets/TR/2021/cg-draft" rel="stylesheet">
<meta content="Bikeshed version f043d3484, updated Fri Feb 17 10:53:48 2023 -0800" name="generator">
<link href="https://github.com/romulocintra/user-locale-client-hints" rel="canonical">
<meta content="bc89a6b0b2f7a5654cbdb96a3050c47d8f397a24" name="document-revision">
<style>/* style-autolinks */
.css.css, .property.property, .descriptor.descriptor {
color: var(--a-normal-text);
font-size: inherit;
font-family: inherit;
}
.css::before, .property::before, .descriptor::before {
content: "‘";
}
.css::after, .property::after, .descriptor::after {
content: "’";
}
.property, .descriptor {
/* Don't wrap property and descriptor names */
white-space: nowrap;
}
.type { /* CSS value <type> */
font-style: italic;
}
pre .property::before, pre .property::after {
content: "";
}
[data-link-type="property"]::before,
[data-link-type="propdesc"]::before,
[data-link-type="descriptor"]::before,
[data-link-type="value"]::before,
[data-link-type="function"]::before,
[data-link-type="at-rule"]::before,
[data-link-type="selector"]::before,
[data-link-type="maybe"]::before {
content: "‘";
}
[data-link-type="property"]::after,
[data-link-type="propdesc"]::after,
[data-link-type="descriptor"]::after,
[data-link-type="value"]::after,
[data-link-type="function"]::after,
[data-link-type="at-rule"]::after,
[data-link-type="selector"]::after,
[data-link-type="maybe"]::after {
content: "’";
}
[data-link-type].production::before,
[data-link-type].production::after,
.prod [data-link-type]::before,
.prod [data-link-type]::after {
content: "";
}
[data-link-type=element],
[data-link-type=element-attr] {
font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;
font-size: .9em;
}
[data-link-type=element]::before { content: "<" }
[data-link-type=element]::after { content: ">" }
[data-link-type=biblio] {
white-space: pre;
}
</style>
<style>/* style-colors */
/* Any --*-text not paired with a --*-bg is assumed to have a transparent bg */
:root {
color-scheme: light dark;
--text: black;
--bg: white;
--unofficial-watermark: url(https://www.w3.org/StyleSheets/TR/2016/logos/UD-watermark);
--logo-bg: #1a5e9a;
--logo-active-bg: #c00;
--logo-text: white;
--tocnav-normal-text: #707070;
--tocnav-normal-bg: var(--bg);
--tocnav-hover-text: var(--tocnav-normal-text);
--tocnav-hover-bg: #f8f8f8;
--tocnav-active-text: #c00;
--tocnav-active-bg: var(--tocnav-normal-bg);
--tocsidebar-text: var(--text);
--tocsidebar-bg: #f7f8f9;
--tocsidebar-shadow: rgba(0,0,0,.1);
--tocsidebar-heading-text: hsla(203,20%,40%,.7);
--toclink-text: var(--text);
--toclink-underline: #3980b5;
--toclink-visited-text: var(--toclink-text);
--toclink-visited-underline: #054572;
--heading-text: #005a9c;
--hr-text: var(--text);
--algo-border: #def;
--del-text: red;
--del-bg: transparent;
--ins-text: #080;
--ins-bg: transparent;
--a-normal-text: #034575;
--a-normal-underline: #bbb;
--a-visited-text: var(--a-normal-text);
--a-visited-underline: #707070;
--a-hover-bg: rgba(75%, 75%, 75%, .25);
--a-active-text: #c00;
--a-active-underline: #c00;
--blockquote-border: silver;
--blockquote-bg: transparent;
--blockquote-text: currentcolor;
--issue-border: #e05252;
--issue-bg: #fbe9e9;
--issue-text: var(--text);
--issueheading-text: #831616;
--example-border: #e0cb52;
--example-bg: #fcfaee;
--example-text: var(--text);
--exampleheading-text: #574b0f;
--note-border: #52e052;
--note-bg: #e9fbe9;
--note-text: var(--text);
--noteheading-text: hsl(120, 70%, 30%);
--notesummary-underline: silver;
--assertion-border: #aaa;
--assertion-bg: #eee;
--assertion-text: black;
--advisement-border: orange;
--advisement-bg: #fec;
--advisement-text: var(--text);
--advisementheading-text: #b35f00;
--warning-border: red;
--warning-bg: hsla(40,100%,50%,0.95);
--warning-text: var(--text);
--amendment-border: #330099;
--amendment-bg: #F5F0FF;
--amendment-text: var(--text);
--amendmentheading-text: #220066;
--def-border: #8ccbf2;
--def-bg: #def;
--def-text: var(--text);
--defrow-border: #bbd7e9;
--datacell-border: silver;
--indexinfo-text: #707070;
--indextable-hover-text: black;
--indextable-hover-bg: #f7f8f9;
--outdatedspec-bg: rgba(0, 0, 0, .5);
--outdatedspec-text: black;
--outdated-bg: maroon;
--outdated-text: white;
--outdated-shadow: red;
--editedrec-bg: darkorange;
}
</style>
<style>/* style-counters */
body {
counter-reset: example figure issue;
}
.issue {
counter-increment: issue;
}
.issue:not(.no-marker)::before {
content: "Issue " counter(issue);
}
.example {
counter-increment: example;
}
.example:not(.no-marker)::before {
content: "Example " counter(example);
}
.invalid.example:not(.no-marker)::before,
.illegal.example:not(.no-marker)::before {
content: "Invalid Example" counter(example);
}
figcaption {
counter-increment: figure;
}
figcaption:not(.no-marker)::before {
content: "Figure " counter(figure) " ";
}
</style>
<style>/* style-dfn-panel */
:root {
--dfnpanel-bg: #ddd;
--dfnpanel-text: var(--text);
}
.dfn-panel {
position: absolute;
z-index: 35;
width: 20em;
min-width: min-content;
max-width: 300px;
height: auto;
max-height: 500px;
overflow: auto;
padding: 0.5em 0.75em;
font: small Helvetica Neue, sans-serif, Droid Sans Fallback;
background: var(--dfnpanel-bg);
color: var(--dfnpanel-text);
border: outset 0.2em;
white-space: normal; /* in case it's moved into a pre */
}
.dfn-panel:not(.on) { display: none; }
.dfn-panel * { margin: 0; padding: 0; text-indent: 0; }
.dfn-panel > b { display: block; }
.dfn-panel a { color: var(--dfnpanel-text); }
.dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; }
.dfn-panel > b + b { margin-top: 0.25em; }
.dfn-panel ul { padding: 0; }
.dfn-panel li { list-style: inside; }
.dfn-panel.activated {
display: inline-block;
position: fixed;
left: .5em;
bottom: 2em;
margin: 0 auto;
max-width: calc(100vw - 1.5em - .4em - .5em);
max-height: 30vh;
}
.dfn-paneled { cursor: pointer; }
</style>
<style>/* style-issues */
a[href].issue-return {
float: right;
float: inline-end;
color: var(--issueheading-text);
font-weight: bold;
text-decoration: none;
}
</style>
<style>/* style-md-lists */
/* This is a weird hack for me not yet following the commonmark spec
regarding paragraph and lists. */
[data-md] > :first-child {
margin-top: 0;
}
[data-md] > :last-child {
margin-bottom: 0;
}
</style>
<style>/* style-selflinks */
:root {
--selflink-text: white;
--selflink-bg: gray;
--selflink-hover-text: black;
}
.heading, .issue, .note, .example, li, dt {
position: relative;
}
a.self-link {
position: absolute;
top: 0;
left: calc(-1 * (3.5rem - 26px));
width: calc(3.5rem - 26px);
height: 2em;
text-align: center;
border: none;
transition: opacity .2s;
opacity: .5;
}
a.self-link:hover {
opacity: 1;
}
.heading > a.self-link {
font-size: 83%;
}
.example > a.self-link,
.note > a.self-link,
.issue > a.self-link {
/* These blocks are overflow:auto, so positioning outside
doesn't work. */
left: auto;
right: 0;
}
li > a.self-link {
left: calc(-1 * (3.5rem - 26px) - 2em);
}
dfn > a.self-link {
top: auto;
left: auto;
opacity: 0;
width: 1.5em;
height: 1.5em;
background: var(--selflink-bg);
color: var(--selflink-text);
font-style: normal;
transition: opacity .2s, background-color .2s, color .2s;
}
dfn:hover > a.self-link {
opacity: 1;
}
dfn > a.self-link:hover {
color: var(--selflink-hover-text);
}
a.self-link::before { content: "¶"; }
.heading > a.self-link::before { content: "§"; }
dfn > a.self-link::before { content: "#"; }
</style>
<style>/* style-syntax-highlighting */
pre.idl.highlight {
background: var(--borderedblock-bg, var(--def-bg));
}
code.highlight { padding: .1em; border-radius: .3em; }
pre.highlight, pre > code.highlight { display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; }
.highlight:not(.idl) { background: rgba(0, 0, 0, .03); }
c-[a] { color: #990055 } /* Keyword.Declaration */
c-[b] { color: #990055 } /* Keyword.Type */
c-[c] { color: #708090 } /* Comment */
c-[d] { color: #708090 } /* Comment.Multiline */
c-[e] { color: #0077aa } /* Name.Attribute */
c-[f] { color: #669900 } /* Name.Tag */
c-[g] { color: #222222 } /* Name.Variable */
c-[k] { color: #990055 } /* Keyword */
c-[l] { color: #000000 } /* Literal */
c-[m] { color: #000000 } /* Literal.Number */
c-[n] { color: #0077aa } /* Name */
c-[o] { color: #999999 } /* Operator */
c-[p] { color: #999999 } /* Punctuation */
c-[s] { color: #a67f59 } /* Literal.String */
c-[t] { color: #a67f59 } /* Literal.String.Single */
c-[u] { color: #a67f59 } /* Literal.String.Double */
c-[cp] { color: #708090 } /* Comment.Preproc */
c-[c1] { color: #708090 } /* Comment.Single */
c-[cs] { color: #708090 } /* Comment.Special */
c-[kc] { color: #990055 } /* Keyword.Constant */
c-[kn] { color: #990055 } /* Keyword.Namespace */
c-[kp] { color: #990055 } /* Keyword.Pseudo */
c-[kr] { color: #990055 } /* Keyword.Reserved */
c-[ld] { color: #000000 } /* Literal.Date */
c-[nc] { color: #0077aa } /* Name.Class */
c-[no] { color: #0077aa } /* Name.Constant */
c-[nd] { color: #0077aa } /* Name.Decorator */
c-[ni] { color: #0077aa } /* Name.Entity */
c-[ne] { color: #0077aa } /* Name.Exception */
c-[nf] { color: #0077aa } /* Name.Function */
c-[nl] { color: #0077aa } /* Name.Label */
c-[nn] { color: #0077aa } /* Name.Namespace */
c-[py] { color: #0077aa } /* Name.Property */
c-[ow] { color: #999999 } /* Operator.Word */
c-[mb] { color: #000000 } /* Literal.Number.Bin */
c-[mf] { color: #000000 } /* Literal.Number.Float */
c-[mh] { color: #000000 } /* Literal.Number.Hex */
c-[mi] { color: #000000 } /* Literal.Number.Integer */
c-[mo] { color: #000000 } /* Literal.Number.Oct */
c-[sb] { color: #a67f59 } /* Literal.String.Backtick */
c-[sc] { color: #a67f59 } /* Literal.String.Char */
c-[sd] { color: #a67f59 } /* Literal.String.Doc */
c-[se] { color: #a67f59 } /* Literal.String.Escape */
c-[sh] { color: #a67f59 } /* Literal.String.Heredoc */
c-[si] { color: #a67f59 } /* Literal.String.Interpol */
c-[sx] { color: #a67f59 } /* Literal.String.Other */
c-[sr] { color: #a67f59 } /* Literal.String.Regex */
c-[ss] { color: #a67f59 } /* Literal.String.Symbol */
c-[vc] { color: #0077aa } /* Name.Variable.Class */
c-[vg] { color: #0077aa } /* Name.Variable.Global */
c-[vi] { color: #0077aa } /* Name.Variable.Instance */
c-[il] { color: #000000 } /* Literal.Number.Integer.Long */
</style>
<style>/* style-darkmode */
@media (prefers-color-scheme: dark) {
:root {
--text: #ddd;
--bg: black;
--unofficial-watermark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cg fill='%23100808' transform='translate(200 200) rotate(-45) translate(-200 -200)' stroke='%23100808' stroke-width='3'%3E%3Ctext x='50%25' y='220' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EUNOFFICIAL%3C/text%3E%3Ctext x='50%25' y='305' style='font: bold 70px sans-serif; text-anchor: middle; letter-spacing: 6px;'%3EDRAFT%3C/text%3E%3C/g%3E%3C/svg%3E");
--logo-bg: #1a5e9a;
--logo-active-bg: #c00;
--logo-text: white;
--tocnav-normal-text: #999;
--tocnav-normal-bg: var(--bg);
--tocnav-hover-text: var(--tocnav-normal-text);
--tocnav-hover-bg: #080808;
--tocnav-active-text: #f44;
--tocnav-active-bg: var(--tocnav-normal-bg);
--tocsidebar-text: var(--text);
--tocsidebar-bg: #080808;
--tocsidebar-shadow: rgba(255,255,255,.1);
--tocsidebar-heading-text: hsla(203,20%,40%,.7);
--toclink-text: var(--text);
--toclink-underline: #6af;
--toclink-visited-text: var(--toclink-text);
--toclink-visited-underline: #054572;
--heading-text: #8af;
--hr-text: var(--text);
--algo-border: #456;
--del-text: #f44;
--del-bg: transparent;
--ins-text: #4a4;
--ins-bg: transparent;
--a-normal-text: #6af;
--a-normal-underline: #555;
--a-visited-text: var(--a-normal-text);
--a-visited-underline: var(--a-normal-underline);
--a-hover-bg: rgba(25%, 25%, 25%, .2);
--a-active-text: #f44;
--a-active-underline: var(--a-active-text);
--borderedblock-bg: rgba(255, 255, 255, .05);
--blockquote-border: silver;
--blockquote-bg: var(--borderedblock-bg);
--blockquote-text: currentcolor;
--issue-border: #e05252;
--issue-bg: var(--borderedblock-bg);
--issue-text: var(--text);
--issueheading-text: hsl(0deg, 70%, 70%);
--example-border: hsl(50deg, 90%, 60%);
--example-bg: var(--borderedblock-bg);
--example-text: var(--text);
--exampleheading-text: hsl(50deg, 70%, 70%);
--note-border: hsl(120deg, 100%, 35%);
--note-bg: var(--borderedblock-bg);
--note-text: var(--text);
--noteheading-text: hsl(120, 70%, 70%);
--notesummary-underline: silver;
--assertion-border: #444;
--assertion-bg: var(--borderedblock-bg);
--assertion-text: var(--text);
--advisement-border: orange;
--advisement-bg: #222218;
--advisement-text: var(--text);
--advisementheading-text: #f84;
--warning-border: red;
--warning-bg: hsla(40,100%,20%,0.95);
--warning-text: var(--text);
--amendment-border: #330099;
--amendment-bg: #080010;
--amendment-text: var(--text);
--amendmentheading-text: #cc00ff;
--def-border: #8ccbf2;
--def-bg: #080818;
--def-text: var(--text);
--defrow-border: #136;
--datacell-border: silver;
--indexinfo-text: #aaa;
--indextable-hover-text: var(--text);
--indextable-hover-bg: #181818;
--outdatedspec-bg: rgba(255, 255, 255, .5);
--outdatedspec-text: black;
--outdated-bg: maroon;
--outdated-text: white;
--outdated-shadow: red;
--editedrec-bg: darkorange;
}
/* In case a transparent-bg image doesn't expect to be on a dark bg,
which is quite common in practice... */
img { background: white; }
}
@media (prefers-color-scheme: dark) {
:root {
--selflink-text: black;
--selflink-bg: silver;
--selflink-hover-text: white;
}
}
@media (prefers-color-scheme: dark) {
:root {
--dfnpanel-bg: #222;
--dfnpanel-text: var(--text);
}
}
@media (prefers-color-scheme: dark) {
.highlight:not(.idl) { background: rgba(255, 255, 255, .05); }
c-[a] { color: #d33682 } /* Keyword.Declaration */
c-[b] { color: #d33682 } /* Keyword.Type */
c-[c] { color: #2aa198 } /* Comment */
c-[d] { color: #2aa198 } /* Comment.Multiline */
c-[e] { color: #268bd2 } /* Name.Attribute */
c-[f] { color: #b58900 } /* Name.Tag */
c-[g] { color: #cb4b16 } /* Name.Variable */
c-[k] { color: #d33682 } /* Keyword */
c-[l] { color: #657b83 } /* Literal */
c-[m] { color: #657b83 } /* Literal.Number */
c-[n] { color: #268bd2 } /* Name */
c-[o] { color: #657b83 } /* Operator */
c-[p] { color: #657b83 } /* Punctuation */
c-[s] { color: #6c71c4 } /* Literal.String */
c-[t] { color: #6c71c4 } /* Literal.String.Single */
c-[u] { color: #6c71c4 } /* Literal.String.Double */
c-[ch] { color: #2aa198 } /* Comment.Hashbang */
c-[cp] { color: #2aa198 } /* Comment.Preproc */
c-[cpf] { color: #2aa198 } /* Comment.PreprocFile */
c-[c1] { color: #2aa198 } /* Comment.Single */
c-[cs] { color: #2aa198 } /* Comment.Special */
c-[kc] { color: #d33682 } /* Keyword.Constant */
c-[kn] { color: #d33682 } /* Keyword.Namespace */
c-[kp] { color: #d33682 } /* Keyword.Pseudo */
c-[kr] { color: #d33682 } /* Keyword.Reserved */
c-[ld] { color: #657b83 } /* Literal.Date */
c-[nc] { color: #268bd2 } /* Name.Class */
c-[no] { color: #268bd2 } /* Name.Constant */
c-[nd] { color: #268bd2 } /* Name.Decorator */
c-[ni] { color: #268bd2 } /* Name.Entity */
c-[ne] { color: #268bd2 } /* Name.Exception */
c-[nf] { color: #268bd2 } /* Name.Function */
c-[nl] { color: #268bd2 } /* Name.Label */
c-[nn] { color: #268bd2 } /* Name.Namespace */
c-[py] { color: #268bd2 } /* Name.Property */
c-[ow] { color: #657b83 } /* Operator.Word */
c-[mb] { color: #657b83 } /* Literal.Number.Bin */
c-[mf] { color: #657b83 } /* Literal.Number.Float */
c-[mh] { color: #657b83 } /* Literal.Number.Hex */
c-[mi] { color: #657b83 } /* Literal.Number.Integer */
c-[mo] { color: #657b83 } /* Literal.Number.Oct */
c-[sa] { color: #6c71c4 } /* Literal.String.Affix */
c-[sb] { color: #6c71c4 } /* Literal.String.Backtick */
c-[sc] { color: #6c71c4 } /* Literal.String.Char */
c-[dl] { color: #6c71c4 } /* Literal.String.Delimiter */
c-[sd] { color: #6c71c4 } /* Literal.String.Doc */
c-[se] { color: #6c71c4 } /* Literal.String.Escape */
c-[sh] { color: #6c71c4 } /* Literal.String.Heredoc */
c-[si] { color: #6c71c4 } /* Literal.String.Interpol */
c-[sx] { color: #6c71c4 } /* Literal.String.Other */
c-[sr] { color: #6c71c4 } /* Literal.String.Regex */
c-[ss] { color: #6c71c4 } /* Literal.String.Symbol */
c-[fm] { color: #268bd2 } /* Name.Function.Magic */
c-[vc] { color: #cb4b16 } /* Name.Variable.Class */
c-[vg] { color: #cb4b16 } /* Name.Variable.Global */
c-[vi] { color: #cb4b16 } /* Name.Variable.Instance */
c-[vm] { color: #cb4b16 } /* Name.Variable.Magic */
c-[il] { color: #657b83 } /* Literal.Number.Integer.Long */
}
</style>
<body class="h-entry">
<div class="head">
<p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p>
<h1 class="p-name no-ref" id="title">User Locale Preferences</h1>
<p id="w3c-state"><a href="https://www.w3.org/standards/types#CG-DRAFT">Draft Community Group Report</a>, <time class="dt-updated" datetime="2023-02-22">22 February 2023</time></p>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
<dd><a class="u-url" href="https://github.com/romulocintra/user-locale-client-hints">https://github.com/romulocintra/user-locale-client-hints</a>
<dt>Issue Tracking:
<dd><a href="https://github.com/romulocintra/user-locale-client-hints/issues/">GitHub</a>
<dt class="editor">Editors:
<dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:[email protected]">Romulo Cintra</a> (<a class="p-org org" href="https://igalia.com">Igalia</a>)
<dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:[email protected]">Ujjwal Sharma</a> (<a class="p-org org" href="https://igalia.com">Igalia</a>)
<dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:[email protected]">Ben Allen</a> (<a class="p-org org" href="https://igalia.com">Igalia</a>)
<dt>Tests:
<dd>(<a href="https://github.com/w3c/web-platform-tests/labels/user-locale-client-hints">ongoing work</a>)
</dl>
</div>
<div data-fill-with="warning"></div>
<p class="copyright" data-fill-with="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2023 the Contributors to the User Locale Preferences Specification, published by the <a href="https://www.w3.org/community/wicg/">Web Platform Incubator Community Group</a> under the <a href="https://www.w3.org/community/about/agreements/cla/">W3C Community Contributor License Agreement (CLA)</a>.
A human-readable <a href="http://www.w3.org/community/about/agreements/cla-deed/">summary</a> is available. </p>
<hr title="Separator for header">
</div>
<div class="p-summary" data-fill-with="abstract">
<h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
<p>This specification introduces a set of <code>Client Hints</code> headers and a homologous <code>Javascript API</code> that will allow a reliable way to access User Locale Preferences information from the Web Platform to help craft better user experiences. Allowing web developers to access this information will allow them to improve the accessibility and usability of their websites, and bring the user experience of web applications closer to that of native applications.</p>
</div>
<div data-fill-with="at-risk"></div>
<h2 class="no-num no-toc no-ref heading settled" id="status"><span class="content">Status of this document</span></h2>
<div data-fill-with="status">
<p> This specification was published by the <a href="https://www.w3.org/community/wicg/">Web Platform Incubator Community Group</a>.
It is not a W3C Standard nor is it on the W3C Standards Track.
Please note that under the <a href="https://www.w3.org/community/about/agreements/cla/">W3C Community Contributor License Agreement (CLA)</a> there is a limited opt-out and other conditions apply.
Learn more about <a href="http://www.w3.org/community/">W3C Community and Business Groups</a>. </p>
<p></p>
</div>
<div data-fill-with="at-risk"></div>
<nav data-fill-with="table-of-contents" id="toc">
<h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
<ol class="toc" role="directory">
<li><a href="#introduction"><span class="secno">1</span> <span class="content">Introduction</span></a>
<li>
<a href="#user-locale-preferences-features"><span class="secno">2</span> <span class="content">User Locale Preferences Features</span></a>
<ol class="toc">
<li>
<a href="#user-locale-preferences-client-hints"><span class="secno">2.1</span> <span class="content">Client Hints</span></a>
<ol class="toc">
<li><a href="#common-user-preferences"><span class="secno">2.1.1</span> <span class="content">Common User Preferences</span></a>
<li><a href="#other-user-preferences"><span class="secno">2.1.2</span> <span class="content">Other user preferences</span></a>
<li><a href="#client-hint-header-fields"><span class="secno">2.1.3</span> <span class="content"><code>Client Hint</code> Header fields</span></a>
<li><a href="#user-locale-client-hints-example"><span class="secno">2.1.4</span> <span class="content">Usage example</span></a>
</ol>
<li>
<a href="#javascript-api"><span class="secno">2.2</span> <span class="content">JavaScript API</span></a>
<ol class="toc">
<li><a href="#user-local-preferences-javascript-idl"><span class="secno">2.2.1</span> <span class="content">IDL</span></a>
<li><a href="#user-locale-preferences-javascript-api-proposed-syntax"><span class="secno">2.2.2</span> <span class="content">Proposed Syntax</span></a>
<li><a href="#user-locale-preferences-javascript-api-examples"><span class="secno">2.2.3</span> <span class="content">Examples</span></a>
</ol>
</ol>
<li><a href="#privacy-and-security-considerations"><span class="secno">3</span> <span class="content">Privacy and Security Considerations</span></a>
<li>
<a href="#w3c-conformance"><span class="secno"></span> <span class="content">Conformance</span></a>
<ol class="toc">
<li><a href="#w3c-conventions"><span class="secno"></span> <span class="content">Document conventions</span></a>
<li><a href="#w3c-conformant-algorithms"><span class="secno"></span> <span class="content">Conformant Algorithms</span></a>
</ol>
<li>
<a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
<ol class="toc">
<li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
<li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
</ol>
<li>
<a href="#references"><span class="secno"></span> <span class="content">References</span></a>
<ol class="toc">
<li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
</ol>
<li><a href="#idl-index"><span class="secno"></span> <span class="content">IDL Index</span></a>
</ol>
</nav>
<main>
<h2 class="heading settled" data-level="1" id="introduction"><span class="secno">1. </span><span class="content">Introduction</span><a class="self-link" href="#introduction"></a></h2>
<p>User preferences are often system-wide settings (such as in Android, macOS, or Windows). Operating systems allow the user to specify custom overrides for settings such as:</p>
<ul>
<li data-md>
<p>Hour cycle (24-hour or 12-hour time)</p>
<li data-md>
<p>Calendar system</p>
<li data-md>
<p>Measurement unit preferences (metric or imperial)</p>
<li data-md>
<p>Date/time patterns</p>
<li data-md>
<p>Number separators (comma or period)</p>
</ul>
<p>Using this information will let developers improve the accessibility and usability of their websites, and bring the user experience of web applications closer to that of native applications. Client- and server-side applications should consistently share and access locale user preferences that will help solve cases like:</p>
<blockquote>
<p>Alice, an end user, reads en-US but prefers using a 24-hour clock. She has set that preference in her operating system settings. Native apps are able to respect her preference. However, web apps cannot access OS user preferences, so on the Web Platform, Alice sees a 12-hour clock, the default for en-US.</p>
</blockquote>
<blockquote>
<p>Other use cases: NodeJS programs that want to respect the user’s hourCycle preference by passing it in to Intl.DateTimeFormat, other non browser environments.</p>
</blockquote>
<p>For <strong>client-side applications</strong>, the best way to get them is through a browser API that fetches this information from the different platform-specific OS APIs.</p>
<p>For <strong>server-side applications</strong>, one way to get access to this information is via <a data-link-type="biblio" href="#biblio-client-hints" title="HTTP Client Hints">[CLIENT-HINTS]</a> headers on the request.</p>
<figure>
<img alt="Browser conveys permitted OS preferences to server" height="300" src="https://user-images.githubusercontent.com/1572026/182210112-69fb7769-eafa-43ab-bad0-21eb49489d50.png" width="500">
<figcaption>Browser conveys permitted OS preference information to server</figcaption>
</figure>
<h2 class="heading settled" data-level="2" id="user-locale-preferences-features"><span class="secno">2. </span><span class="content">User Locale Preferences Features</span><a class="self-link" href="#user-locale-preferences-features"></a></h2>
<p>We propose to address the above use cases by using a pair of <a data-link-type="biblio" href="#biblio-client-hints" title="HTTP Client Hints">[CLIENT-HINTS]</a> headers and a homologous <a href="#javascript-api">§ 2.2 JavaScript API</a>. Both will be responsible for exposing and negotiating the exchange of user preferences from the OS to the required environment.</p>
<p>We use <a data-link-type="dfn" href="https://cldr.unicode.org/index/bcp47-extension#unicode-extensions-for-bcp-47" id="ref-for-unicode-extensions-for-bcp-47">Unicode Extensions for BCP 47</a> or compatible as the main reference for the base mechanism for delivering user locale preferences. We define new standard <dfn data-dfn-type="dfn" data-export id="locale-preferences"><code>Locale-Preferences</code><a class="self-link" href="#locale-preferences"></a></dfn> Client Hints and <dfn data-dfn-for="NavigatorLocalePreferences" data-dfn-type="dfn" data-export id="navigatorlocalepreferences-navigatorlocalepreferences"><code>navigator.localePreferences</code><a class="self-link" href="#navigatorlocalepreferences-navigatorlocalepreferences"></a></dfn>, that map the user locale preferences using the following steps:</p>
<ol>
<li data-md>
<p>Validate if there is any fingerprinting mechanism and if OS preferences are allowed to be exposed</p>
<li data-md>
<p>Read the available OS preferences</p>
<li data-md>
<p>Return values</p>
</ol>
<h3 class="heading settled" data-level="2.1" id="user-locale-preferences-client-hints"><span class="secno">2.1. </span><span class="content">Client Hints</span><a class="self-link" href="#user-locale-preferences-client-hints"></a></h3>
<p>An <a data-link-type="dfn" href="https://cldr.unicode.org/index/bcp47-extension#http-client-hint" id="ref-for-http-client-hint">HTTP Client Hint</a> is a request header field that is used by HTTP clients to indicate configuration data that can be used by the server to select an appropriate response. It defines an <code>Accept-CH</code> response header that servers can use to advertise their use of request headers for proactive content negotiation. Each new client hint conveys a list of user locale preferences that the server can use to adapt and optimize responses.</p>
<p>The following table suggests <a data-link-type="dfn" href="https://github.com/tc39/ecma402/issues/416#issue-574957588common-user-preferences" id="ref-for-issue-574957588common-user-preferences">common user preferences</a> to be used, and does the correlation from <code>Locale-Preferences</code> Client Hints and <code>navigator.localePreferences</code> to extension keys if they exist, or other values in case table is extended by user demand.</p>
<h4 class="heading settled" data-level="2.1.1" id="common-user-preferences"><span class="secno">2.1.1. </span><span class="content">Common User Preferences</span><a class="self-link" href="#common-user-preferences"></a></h4>
<table>
<tbody>
<tr>
<td>"calendar"
<td><code>ca</code>
<td>buddhist, chinese...
<td>[Calendar system / Calendar algorithm]
<tr>
<td>"currencyFormat"
<td><code>cf</code>
<td>standard, account
<td>Currency Format style, whether to use accounting currency format
<tr>
<td> "collation"
<td> <code>co</code>
<td> standard, search, phonetic...
<td> Collation type, sort order
<tr>
<td> "currencyCode"
<td> <code>cu</code>
<td> ISO 4217 codes
<td> Currency type
<tr>
<td> "emojiStyle"
<td> <code>em</code>
<td> emoji , text, default
<td> Emoji presentation style
<tr>
<td> "firstDayOfTheWeek"
<td> <code>fw</code>
<td> "sun", "mon" ... "sat"
<td> First day of week
<tr>
<td> "hourCycle"
<td> <code>hc</code>
<td> h12 , h23, h11, h24
<td> Hour cycle, i.e., 12-hour or 24-hour clock
<tr>
<td> "measurementSystem"
<td> <code>ms</code>
<td> metric , ussystem , uksystem
<td> Measurement system
<tr>
<td> "measurementUnit"
<td> <code>mu</code>
<td> celsius , kelvin , fahrenhe
<td> <a href="https://github.com/unicode-org/cldr/blob/7942fd82f7e673eb0b27f0bf2025a31572135d95/common/bcp47/measure.xml#L16">Measurement units currently only temperature</a>
<tr>
<td> "numberingSystem"
<td> <code>nu</code>
<td> Unicode script subtag(arabext...) <br>
<td> Numbering system
<tr>
<td> "timeZone"
<td> <code>tz</code>
<td> Unicode short time zone IDs
<td> Time zone
<tr>
<td> "region"
<td> <code>rg</code>
<td> <a href="https://unicode.org/reports/tr35/tr35.html#unicode_region_subtag">Unicode Region Subtag</a>
<td> Region override
<thead>
<tr>
<th>Locale Preferences Name
<th>Extension Key/Unicode Source
<th>Example Values
<th>Description
</table>
<h4 class="heading settled" data-level="2.1.2" id="other-user-preferences"><span class="secno">2.1.2. </span><span class="content">Other user preferences</span><a class="self-link" href="#other-user-preferences"></a></h4>
Other user preferences that might be included based on user research about OS preferences inputs and <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1308329">#1308329</a>. Although most of the preferences below do not have a 1:1 match with BCP47 extension keys, they are available in ICU/CLDR.
<ul>
<li data-md>
<p>number separator (grouping/decimal)</p>
<li data-md>
<p>date formats short/medium/long/full</p>
<li data-md>
<p>time formats short/medium/long/full</p>
<li data-md>
<p>dayPeriod names</p>
<li data-md>
<p>time display with/without seconds</p>
<li data-md>
<p>flash the time separators</p>
<li data-md>
<p>show dayPeriod</p>
<li data-md>
<p>show the day of the week</p>
<li data-md>
<p>show date</p>
</ul>
<blockquote>
<p class="note" role="note"><span class="marker">Note:</span> The specific preferences ultimately included need to be validated and agreed to by security teams and stakeholders. For this proposal, we consider a subset of possible preferences, sorted into two categories: DateTime and LanguageRegion.</p>
</blockquote>
<h4 class="heading settled" data-level="2.1.3" id="client-hint-header-fields"><span class="secno">2.1.3. </span><span class="content"><code>Client Hint</code> Header fields</span><a class="self-link" href="#client-hint-header-fields"></a></h4>
<p>Servers will receive no information about the user’s locale preferences. Servers can instead opt into receiving such information via new <code>Locale-Preferences</code> Client Hints.</p>
<p>To accomplish this, browsers should introduce a pair of new <code>Client Hint</code> header fields as part of a <a data-link-type="dfn" href="https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-header-structure#structured-header" id="ref-for-structured-header">structured header</a> as defined in <a data-link-type="biblio" href="#biblio-draft-ietf-httpbis-header-structure-19" title="Structured Field Values for HTTP">[draft-ietf-httpbis-header-structure-19]</a>, sent over request whose value is a list of defined user locale preferences.</p>
<p>**<code>Sec-CH-Locale-Preferences-*</code>**</p>
<p>The following table represents the two headers returning individual opted-in <code>Locale-Preferences</code>. These headers group together related sets of preferences in two buckets:</p>
<table>
<tbody>
<tr>
<td><dfn data-dfn-type="dfn" data-export id="sec-ch-locale-preferences-datetime">Sec-CH-Locale-Preferences-DateTime<a class="self-link" href="#sec-ch-locale-preferences-datetime"></a></dfn>
<td> <code>Sec-CH-Locale-Preferences-DateTime</code> : hourCycle="h24";timeZone="CET";...
<tr>
<td><dfn data-dfn-type="dfn" data-export id="sec-ch-locale-preferences-languageregion">Sec-CH-Locale-Preferences-LanguageRegion<a class="self-link" href="#sec-ch-locale-preferences-languageregion"></a></dfn>
<td> <code>Sec-CH-Locale-Preferences-LanguageRegion</code> : calendar="buddhist"; measurementSystem="metric"; ...
<thead>
<tr>
<th left style="text-align:">Client hint
<th left style="text-align:"> Example output
</table>
<h4 class="heading settled" data-level="2.1.4" id="user-locale-client-hints-example"><span class="secno">2.1.4. </span><span class="content">Usage example</span><a class="self-link" href="#user-locale-client-hints-example"></a></h4>
<div class="example" id="example-370e5b09">
<a class="self-link" href="#example-370e5b09"></a>
<ol>
<li data-md>
<p>The client makes an initial request to the server:</p>
</ol>
<pre class="language-http highlight"><c- nf>GET</c-> <c- nn>/</c-> <c- kr>HTTP</c-><c- o>/</c-><c- m>1.1</c->
<c- e>Host</c-><c- o>:</c-> <c- l>example.com</c->
</pre>
<ol start="2">
<li data-md>
<p>The server responds, telling the client via an <code>Accept-CH</code> header (Section 2.2.1 of <a data-link-type="biblio" href="#biblio-rfc8942" title="HTTP Client Hints">[RFC8942]</a>) along with the initial response with <code>Sec-CH-Locale-Preferences-DateTime</code> and the <code>Sec-CH-Locale-Preferences-LanguageRegion</code> Client Hints:</p>
</ol>
<pre class="language-http highlight"><c- kr>HTTP</c-><c- o>/</c-><c- m>1.1</c-> <c- m>200</c-> <c- ne>OK</c->
<c- e>Content-Type</c-><c- o>:</c-> <c- l>text/html</c->
<c- e>Accept-CH</c-><c- o>:</c-> <c- l>Sec-CH-Locale-Preferences-DateTime, Sec-CH-Locale-Preferences-LanguageRegion</c->
</pre>
<ol start="3">
<li data-md>
<p>Subsequent requests to https://example.com will include the following request headers in case the user sets <code>numberingSystem</code> and <code>timeZone</code> values:</p>
</ol>
<pre class="language-http highlight"><c- nf>GET</c-> <c- nn>/</c-> <c- kr>HTTP</c-><c- o>/</c-><c- m>1.1</c->
<c- e>Host</c-><c- o>:</c-> <c- l>example.com</c->
<c- e>Sec-CH-Locale-Preferences-DateTime</c-><c- o>:</c-> <c- l>timeZone="CET"</c->
<c- e>Sec-CH-Locale-Preferences-LanguageRegion</c-><c- o>:</c-> <c- l>numberingSystem="jpan"</c->
</pre>
<ol start="4">
<li data-md>
<p>The server can then tailor the response to the client’s preferences accordingly.</p>
</ol>
</div>
<h3 class="heading settled" data-level="2.2" id="javascript-api"><span class="secno">2.2. </span><span class="content">JavaScript API</span><a class="self-link" href="#javascript-api"></a></h3>
<p>These client hints should also be exposed as JavaScript APIs via <code>navigator.locales</code> as suggested in <a href="https://github.com/tc39/ecma402/issues/68">#68</a> or by creating a new <code>navigator.localePreferences</code> that exposes <code>Locale-Preferences</code> information as below.</p>
<h4 class="heading settled" data-level="2.2.1" id="user-local-preferences-javascript-idl"><span class="secno">2.2.1. </span><span class="content">IDL</span><a class="self-link" href="#user-local-preferences-javascript-idl"></a></h4>
<pre class="idl highlight def"><c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-localepreferenceslanguageregion"><code><c- g>LocalePreferencesLanguageRegion</c-></code></dfn> {
<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString"><c- b>DOMString</c-></a> <dfn class="idl-code" data-dfn-for="LocalePreferencesLanguageRegion" data-dfn-type="dict-member" data-export data-type="DOMString " id="dom-localepreferenceslanguageregion-calendar"><code><c- g>calendar</c-></code><a class="self-link" href="#dom-localepreferenceslanguageregion-calendar"></a></dfn>;
<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString①"><c- b>DOMString</c-></a> <dfn class="idl-code" data-dfn-for="LocalePreferencesLanguageRegion" data-dfn-type="dict-member" data-export data-type="DOMString " id="dom-localepreferenceslanguageregion-measurementsystem"><code><c- g>measurementSystem</c-></code><a class="self-link" href="#dom-localepreferenceslanguageregion-measurementsystem"></a></dfn>;
<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString②"><c- b>DOMString</c-></a> <dfn class="idl-code" data-dfn-for="LocalePreferencesLanguageRegion" data-dfn-type="dict-member" data-export data-type="DOMString " id="dom-localepreferenceslanguageregion-measurementunit"><code><c- g>measurementUnit</c-></code><a class="self-link" href="#dom-localepreferenceslanguageregion-measurementunit"></a></dfn>;
<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString③"><c- b>DOMString</c-></a> <dfn class="idl-code" data-dfn-for="LocalePreferencesLanguageRegion" data-dfn-type="dict-member" data-export data-type="DOMString " id="dom-localepreferenceslanguageregion-numberingsystem"><code><c- g>numberingSystem</c-></code><a class="self-link" href="#dom-localepreferenceslanguageregion-numberingsystem"></a></dfn>;
<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString④"><c- b>DOMString</c-></a> <dfn class="idl-code" data-dfn-for="LocalePreferencesLanguageRegion" data-dfn-type="dict-member" data-export data-type="DOMString " id="dom-localepreferenceslanguageregion-region"><code><c- g>region</c-></code><a class="self-link" href="#dom-localepreferenceslanguageregion-region"></a></dfn>;
};
<c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-localepreferencesdatetime"><code><c- g>LocalePreferencesDateTime</c-></code></dfn> {
<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString⑤"><c- b>DOMString</c-></a> <dfn class="idl-code" data-dfn-for="LocalePreferencesDateTime" data-dfn-type="dict-member" data-export data-type="DOMString " id="dom-localepreferencesdatetime-dateformat"><code><c- g>dateFormat</c-></code><a class="self-link" href="#dom-localepreferencesdatetime-dateformat"></a></dfn>;
<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString⑥"><c- b>DOMString</c-></a> <dfn class="idl-code" data-dfn-for="LocalePreferencesDateTime" data-dfn-type="dict-member" data-export data-type="DOMString " id="dom-localepreferencesdatetime-timeformats"><code><c- g>timeFormats</c-></code><a class="self-link" href="#dom-localepreferencesdatetime-timeformats"></a></dfn>;
<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString⑦"><c- b>DOMString</c-></a> <dfn class="idl-code" data-dfn-for="LocalePreferencesDateTime" data-dfn-type="dict-member" data-export data-type="DOMString " id="dom-localepreferencesdatetime-timezone"><code><c- g>timeZone</c-></code><a class="self-link" href="#dom-localepreferencesdatetime-timezone"></a></dfn>;
<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString⑧"><c- b>DOMString</c-></a> <dfn class="idl-code" data-dfn-for="LocalePreferencesDateTime" data-dfn-type="dict-member" data-export data-type="DOMString " id="dom-localepreferencesdatetime-hourcycle"><code><c- g>hourCycle</c-></code><a class="self-link" href="#dom-localepreferencesdatetime-hourcycle"></a></dfn>;
<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString⑨"><c- b>DOMString</c-></a> <dfn class="idl-code" data-dfn-for="LocalePreferencesDateTime" data-dfn-type="dict-member" data-export data-type="DOMString " id="dom-localepreferencesdatetime-firstdayoftheweek"><code><c- g>firstDayOfTheWeek</c-></code><a class="self-link" href="#dom-localepreferencesdatetime-firstdayoftheweek"></a></dfn>;
};
<c- b>interface</c-> <c- b>mixin</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="navigatorlocalepreferences"><code><c- g>NavigatorLocalePreferences</c-></code></dfn> {
<c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="#dictdef-localepreferenceslanguageregion" id="ref-for-dictdef-localepreferenceslanguageregion"><c- n>LocalePreferencesLanguageRegion</c-></a> <dfn class="idl-code" data-dfn-for="NavigatorLocalePreferences" data-dfn-type="attribute" data-export data-readonly data-type="LocalePreferencesLanguageRegion" id="dom-navigatorlocalepreferences-localeregion"><code><c- g>localeRegion</c-></code><a class="self-link" href="#dom-navigatorlocalepreferences-localeregion"></a></dfn>;
<c- b>readonly</c-> <c- b>attribute</c-> <a data-link-type="idl-name" href="#dictdef-localepreferencesdatetime" id="ref-for-dictdef-localepreferencesdatetime"><c- n>LocalePreferencesDateTime</c-></a> <dfn class="idl-code" data-dfn-for="NavigatorLocalePreferences" data-dfn-type="attribute" data-export data-readonly data-type="LocalePreferencesDateTime" id="dom-navigatorlocalepreferences-datetime"><code><c- g>dateTime</c-></code><a class="self-link" href="#dom-navigatorlocalepreferences-datetime"></a></dfn>;
};
<a data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/system-state.html#navigator" id="ref-for-navigator"><c- n>Navigator</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="#navigatorlocalepreferences" id="ref-for-navigatorlocalepreferences"><c- n>NavigatorLocalePreferences</c-></a>;
<a data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/workers.html#workernavigator" id="ref-for-workernavigator"><c- n>WorkerNavigator</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="#navigatorlocalepreferences" id="ref-for-navigatorlocalepreferences①"><c- n>NavigatorLocalePreferences</c-></a>;
</pre>
<h4 class="heading settled" data-level="2.2.2" id="user-locale-preferences-javascript-api-proposed-syntax"><span class="secno">2.2.2. </span><span class="content">Proposed Syntax</span><a class="self-link" href="#user-locale-preferences-javascript-api-proposed-syntax"></a></h4>
<div class="example" id="example-b1c63c51">
<a class="self-link" href="#example-b1c63c51"></a>
<pre class="language-js highlight"><c- c1>// languageAndRegion</c->
navigator<c- p>.</c->localePreferences<c- p>[</c-><c- t>'languageRegion'</c-><c- p>];</c->
navigator<c- p>.</c->localePreferences<c- p>.</c->languageRegion<c- p>;</c->
self<c- p>.</c->navigator<c- p>.</c->localePreferences<c- p>.</c->languageRegion<c- p>;</c->
<c- c1>// Output => => {calendar: "buddhist", measurementSystem: "metric", ... }</c->
<c- c1>// languageAndRegion</c->
navigator<c- p>.</c->localePreferences<c- p>[</c-><c- t>'dateTime'</c-><c- p>];</c->
navigator<c- p>.</c->localePreferences<c- p>.</c->dateTime<c- p>;</c->
self<c- p>.</c->navigator<c- p>.</c->localePreferences<c- p>.</c->dateTime<c- p>;</c->
<c- c1>// Output => { dateFormat: "EEE, d MMM yyyy HH:mm:ss Z", ... }</c->
<c- c1>// Window or WorkerGlobalScope event </c->
window<c- p>.</c->onlocalepreferences <c- o>=</c-> <c- p>(</c->event<c- p>)</c-> <c- p>=></c-> <c- p>{</c->
console<c- p>.</c->log<c- p>(</c-><c- t>'localepreferences event detected!'</c-><c- p>);</c->
<c- p>};</c->
<c- c1>// Or </c->
window<c- p>.</c->addEventListener<c- p>(</c-><c- t>'localepreferences'</c-><c- p>,</c-> <c- p>()</c-> <c- p>=></c-> <c- p>{</c->
console<c- p>.</c->log<c- p>(</c-><c- t>'localepreferences event detected!'</c-><c- p>);</c->
<c- p>});</c->
</pre>
</div>
<h4 class="heading settled" data-level="2.2.3" id="user-locale-preferences-javascript-api-examples"><span class="secno">2.2.3. </span><span class="content">Examples</span><a class="self-link" href="#user-locale-preferences-javascript-api-examples"></a></h4>
<div class="example" id="example-8a397687">
<a class="self-link" href="#example-8a397687"></a>
<p>Use the <code>navigator.localePreferences</code> to populate data with user preferences</p>
<pre class="language-js highlight"><c- c1>// User set locale preferences for calendar , region and hourCycle</c->
navigator<c- p>.</c->localePreferences<c- p>[</c-><c- t>'languageRegion'</c-><c- p>];</c->
navigator<c- p>.</c->localePreferences<c- p>[</c-><c- t>'dateTime'</c-><c- p>];</c->
<c- a>const</c-> preferences <c- o>=</c-> <c- p>(...</c->iterate over needed navigator<c- p>.</c->localePreferences <c- p>)</c->
<c- ow>new</c-> Intl<c- p>.</c->Locale<c- p>(</c-><c- t>'es'</c-> <c- p>,</c-> preferences <c- p>).</c->maximize<c- p>();</c->
<c- c1>// => Locale {..., calendar:"gregory" , region:"GB" , hourCycle:"h11" }</c->
<c- ow>new</c-> Intl<c- p>.</c->DateTimeFormat<c- p>(</c-><c- t>'es'</c-><c- p>,</c-> preferences <c- p>).</c->resolvedOptions<c- p>();</c->
<c- c1>// => {locale: 'es', calendar: 'gregory', numberingSystem: 'latn', timeZone: 'Europe/London', ...}</c->
</pre>
</div>
<h2 class="heading settled" data-level="3" id="privacy-and-security-considerations"><span class="secno">3. </span><span class="content">Privacy and Security Considerations</span><a class="self-link" href="#privacy-and-security-considerations"></a></h2>
<p>There are some concerns that exposing this information would give trackers, advertisers and malicious web services another fingerprinting vector. That said, this information may or may not already be available to a certain extent to such services, based on the host and the user’s settings. The use of <code>Sec-CH-</code> prefix is to forbid access to headers containing <code>Locale Preferences</code> information from JavaScript, and to demarcate them as browser-controlled client hints so that they can be documented and included in requests without triggering CORS preflights.</p>
<p>Client Hints provides a powerful content negotiation mechanism that enables us to adapt content to users' needs without compromising their privacy. It does that by requiring server opt-in, which guarantees that access to the information requires active and tracable action on the server’s side. As such, the mechanism does not increase the web’s current active fingerprinting surface.</p>
<p>The Security Considerations of <a data-link-type="biblio" href="#biblio-client-hints" title="HTTP Client Hints">[CLIENT-HINTS]</a> and <a data-link-type="biblio" href="#biblio-draft-davidben-http-client-hint-reliability-02" title="Client Hint Reliability">[draft-davidben-http-client-hint-reliability-02]</a> likewise apply to this proposal.</p>
</main>
<div data-fill-with="conformance">
<h2 class="no-ref no-num heading settled" id="w3c-conformance"><span class="content">Conformance</span><a class="self-link" href="#w3c-conformance"></a></h2>
<h3 class="no-ref no-num heading settled" id="w3c-conventions"><span class="content">Document conventions</span><a class="self-link" href="#w3c-conventions"></a></h3>
<p>Conformance requirements are expressed
with a combination of descriptive assertions
and RFC 2119 terminology.
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL”
in the normative parts of this document
are to be interpreted as described in RFC 2119.
However, for readability,
these words do not appear in all uppercase letters in this specification. </p>
<p>All of the text of this specification is normative
except sections explicitly marked as non-normative, examples, and notes. <a data-link-type="biblio" href="#biblio-rfc2119" title="Key words for use in RFCs to Indicate Requirement Levels">[RFC2119]</a> </p>
<p>Examples in this specification are introduced with the words “for example”
or are set apart from the normative text
with <code>class="example"</code>,
like this: </p>
<div class="example" id="w3c-example">
<a class="self-link" href="#w3c-example"></a>
<p>This is an example of an informative example. </p>
</div>
<p>Informative notes begin with the word “Note”
and are set apart from the normative text
with <code>class="note"</code>,
like this: </p>
<p class="note" role="note">Note, this is an informative note.</p>
<h3 class="no-ref no-num heading settled" id="w3c-conformant-algorithms"><span class="content">Conformant Algorithms</span><a class="self-link" href="#w3c-conformant-algorithms"></a></h3>
<p>Requirements phrased in the imperative as part of algorithms
(such as "strip any leading space characters"
or "return false and abort these steps")
are to be interpreted with the meaning of the key word
("must", "should", "may", etc)
used in introducing the algorithm. </p>
<p>Conformance requirements phrased as algorithms or specific steps
can be implemented in any manner,
so long as the end result is equivalent.
In particular, the algorithms defined in this specification
are intended to be easy to understand
and are not intended to be performant.
Implementers are encouraged to optimize. </p>
</div>
<script src="https://www.w3.org/scripts/TR/2021/fixup.js"></script>
<h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2>
<h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3>
<ul class="index">
<li><a href="#dom-localepreferenceslanguageregion-calendar">calendar</a><span>, in § 2.2.1</span>
<li><a href="#dom-localepreferencesdatetime-dateformat">dateFormat</a><span>, in § 2.2.1</span>
<li><a href="#dom-navigatorlocalepreferences-datetime">dateTime</a><span>, in § 2.2.1</span>
<li><a href="#dom-localepreferencesdatetime-firstdayoftheweek">firstDayOfTheWeek</a><span>, in § 2.2.1</span>
<li><a href="#dom-localepreferencesdatetime-hourcycle">hourCycle</a><span>, in § 2.2.1</span>
<li><a href="#locale-preferences">Locale-Preferences</a><span>, in § 2</span>
<li><a href="#dictdef-localepreferencesdatetime">LocalePreferencesDateTime</a><span>, in § 2.2.1</span>
<li><a href="#dictdef-localepreferenceslanguageregion">LocalePreferencesLanguageRegion</a><span>, in § 2.2.1</span>
<li><a href="#dom-navigatorlocalepreferences-localeregion">localeRegion</a><span>, in § 2.2.1</span>
<li><a href="#dom-localepreferenceslanguageregion-measurementsystem">measurementSystem</a><span>, in § 2.2.1</span>
<li><a href="#dom-localepreferenceslanguageregion-measurementunit">measurementUnit</a><span>, in § 2.2.1</span>
<li><a href="#navigatorlocalepreferences-navigatorlocalepreferences">navigator.localePreferences</a><span>, in § 2</span>
<li><a href="#navigatorlocalepreferences">NavigatorLocalePreferences</a><span>, in § 2.2.1</span>
<li><a href="#dom-localepreferenceslanguageregion-numberingsystem">numberingSystem</a><span>, in § 2.2.1</span>
<li><a href="#dom-localepreferenceslanguageregion-region">region</a><span>, in § 2.2.1</span>
<li><a href="#sec-ch-locale-preferences-datetime">Sec-CH-Locale-Preferences-DateTime</a><span>, in § 2.1.3</span>
<li><a href="#sec-ch-locale-preferences-languageregion">Sec-CH-Locale-Preferences-LanguageRegion</a><span>, in § 2.1.3</span>
<li><a href="#dom-localepreferencesdatetime-timeformats">timeFormats</a><span>, in § 2.2.1</span>