-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
276 lines (255 loc) · 9.13 KB
/
demo.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
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>intl-elements demo</title>
<style>
body {
font-family: sans-serif;
}
intl-segmenter-segment::part(wordlike) {
white-space: nowrap;
}
</style>
<script type="importmap">
{
"imports": {
"@lit": "./node_modules/@lit/index.js",
"@lit/reactive-element": "./node_modules/@lit/reactive-element/reactive-element.js",
"@lit/reactive-element/": "./node_modules/@lit/reactive-element/",
"lit": "./node_modules/lit/index.js",
"lit/": "./node_modules/lit/",
"lit-element/": "./node_modules/lit-element/",
"lit-html": "./node_modules/lit-html/lit-html.js",
"lit-html/": "./node_modules/lit-html/"
}
}
</script>
<h1>intl-elements demo</h1>
<h2><code>intl-locale</code></h2>
<p><intl-locale tag="zh-cn"></intl-locale></p>
<p><intl-locale tag="ko" option-script="kore" option-region="kr" option-hourcycle="h24"></intl-locale></p>
<h2><code>intl-displaynames</code></h2>
<intl-displaynames id="language" locales="en" option-type="language">
<p><intl-displaynames-of><data value="zh-cn">chinese</data></intl-displaynames-of></p>
<p><intl-displaynames-of><data value="zh-hant">chinese</data></intl-displaynames-of></p>
</intl-displaynames>
<p>
<intl-displaynames locales="ko" option-type="datetimefield">
<intl-displaynames-of><data value="minute">minute</data></intl-displaynames-of>
</intl-displaynames>
</p>
<intl-displaynames id="zh-langs" locales="zh" option-type="language"></intl-displaynames>
<ul>
<li><intl-displaynames-of provider="zh-langs"><data value="ug-Arab"></data></intl-displaynames-of></li>
<li><intl-displaynames-of provider="zh-langs"><data value="de-AT"></data></intl-displaynames-of></li>
<li><intl-displaynames-of provider="zh-langs"><data value="sw"></data></intl-displaynames-of></li>
</ul>
<h2><code>intl-listformat</code></h2>
<intl-listformat locales="en">
<p>
<intl-listformat-format>
<data value="corgi">corgi</data>
<data value="pomerania">pomeranian</data>
<data value="pug">pug</data>
<data value="shar-pei">shar-pei</data>
<data value="pitbull">pitbull</data>
</intl-listformat-format>
</p>
<p>
<intl-listformat-formattoparts>
<data value="corgi">corgi</data>
<data value="pomerania">pomeranian</data>
<data value="pug">pug</data>
<data value="shar-pei">shar-pei</data>
<data value="pitbull">pitbull</data>
</intl-listformat-formattoparts>
</p>
</intl-listformat>
<h2><code>intl-numberformat</code></h2>
<intl-numberformat locales="en" option-style="currency" option-currency="usd">
<p>
<intl-numberformat-format>
<data value="1234567.89">USD 1234567.89</data>
</intl-numberformat-format>
</p>
<p>
<intl-numberformat-formattoparts>
<data value="1234567.89">USD 1234567.89</data>
</intl-numberformat-formattoparts>
</p>
<p>
<intl-numberformat-formatrange>
from <data value="123.89">USD 123.89</data>
to <data value="456.89">USD 456.89</data>
</intl-numberformat-formatrange>
</p>
<p>
<intl-numberformat-formatrange>
from <data slot="start" value="123.89">USD 123.89</data>
to <data slot="end" value="456.89">USD 456.89</data>
</intl-numberformat-formatrange>
</p>
<p>
<intl-numberformat-formatrange>
from <data value="123.89">USD 123.89</data>
to <data slot="end" value="456.89">USD 456.89</data>
</intl-numberformat-formatrange>
</p>
<p>
<intl-numberformat-formatrange>
from <data slot="start" value="123.89">USD 123.89</data>
to <data value="456.89">USD 456.89</data>
</intl-numberformat-formatrange>
</p>
<p>
<intl-numberformat-formatrangetoparts>
from <data slot="start" value="123.89">USD 123.89</data>
to <data slot="end" value="456.89">USD 456.89</data>
</intl-numberformat-formatrangetoparts>
</p>
</intl-numberformat>
<h2><code>intl-relativetimeformat</code></h2>
<intl-relativetimeformat locales="en">
<p>
<intl-relativetimeformat-format>
<data slot="rtime" value="-10">10</data>
<data slot="unit" value="minute">minutes</data>
</intl-relativetimeformat-format>
</p>
<p>
<intl-relativetimeformat-format>
<data value="1.5">1.5</data>
<data value="minute">min.</data>
</intl-relativetimeformat-format>
</p>
<p>
<intl-relativetimeformat-formattoparts>
<data value="-3.5">-3.5</data>
<data value="quarters">quarters</data>
</intl-relativetimeformat-formattoparts>
</p>
</intl-relativetimeformat>
<h2><code>intl-segmenter</code></h2>
<p>
<intl-segmenter locales="ja" option-granularity="word">
<intl-segmenter-segment>こんにちは世界</intl-segmenter-segment>
</intl-segmenter>
</p>
<p>
<intl-segmenter locales="hi">
<intl-segmenter-segment>हैलो वर्ल्ड!</intl-segmenter-segment>
</intl-segmenter>
</p>
<p>
<intl-segmenter locales="zh" option-granularity="word">
<intl-segmenter-segment>神奇一刻(DisneyBox.com)是非官方的迪士尼爱好者互联网交流平台。我们通过论坛(即迪士尼华语坛)把全球喜爱迪士尼的华人连接在一起,让大家分享对迪士尼的情感和欢乐,并通过迪士尼百科资料库、迪士尼歌词库、Dissenger 等内容丰富的专业栏目为广大影迷提供信息和交流的机会。</intl-segmenter-segment>
</intl-segmenter>
</p>
<h2><code>intl-datetimeformat</code></h2>
<intl-datetimeformat locales="he">
<p>
<intl-datetimeformat-format>
<time datetime="1965-07-12">july 12, 1965</time>
</intl-datetimeformat-format>
</p>
<p>
<intl-datetimeformat-formattoparts>
<time datetime="1965-07-12">july 12, 1965</time>
</intl-datetimeformat-formattoparts>
</p>
<p>
<intl-datetimeformat-formatrange>
<time datetime="1965-07-12">july 12, 1965</time> ~
<time datetime="2022-11-28">november 28, 2022</time>
</intl-datetimeformat-formatrange>
</p>
<p>
<intl-datetimeformat-formatrange>
<time slot="start" datetime="1965-07-12">july 12, 1965</time> to
<time slot="end" datetime="2022-11-28">november 28, 2022</time>
</intl-datetimeformat-formatrange>
</p>
<p>
<intl-datetimeformat-formatrangetoparts>
<time slot="start" datetime="1965-07-12">july 12, 1965</time> to
<time slot="end" datetime="2022-11-28">november 28, 2022</time>
</intl-datetimeformat-formatrangetoparts>
</p>
</intl-datetimeformat>
<h2><code>intl-pluralrules</code></h2>
<intl-pluralrules locales="en">
<p>
<intl-pluralrules-select>
<data value="1">1 dog</data>
<template slot="zero">No dogs</template>
<template slot="one"><ins></ins> dog</template>
<template slot="two">Two (<ins></ins>) dogs</template>
<template slot="few">Few (<ins></ins>) dogs</template>
<template slot="many">Many (<ins></ins>) dogs</template>
<template slot="other"><ins></ins> dogs</template>
</intl-pluralrules-select>
</p>
</intl-pluralrules>
<intl-pluralrules locales="en" option-type="ordinal">
<p>
<intl-pluralrules-select>
<data value="1">1 dog</data>
<template slot="one">the <ins></ins>st dog</template>
<template slot="two">the <ins></ins>nd dog</template>
<template slot="few">the <ins></ins>rd dog</template>
<template slot="other">the <ins></ins>th dog</template>
</intl-pluralrules-select>
</p>
</intl-pluralrules>
<h2><code>intl-collator</code></h2>
<intl-collator locales="zh-u-co-pinyin">
<intl-collator-compare>
<div slot="list">
<div>铁拐李</div>
<div>张果老</div>
<div>何仙姑</div>
<div>蓝采和</div>
<div>汉钟离</div>
<div>曹国舅</div>
<div>吕洞宾</div>
<div>韩湘子</div>
</div>
</intl-collator-compare>
</intl-collator>
<hr>
<intl-collator locales="de-u-co-phonebk">
<intl-collator-compare>
<ul slot="list">
<li>Offenbach</li>
<li>Österreich</li>
<li>Odenwald</li>
</ul>
</intl-collator-compare>
<hr>
<intl-collator-compare>
<div slot="list">
<div>Hello</div>
<div>Offenbach</div>
<div>Österreich</div>
<div>Odenwald</div>
</div>
</intl-collator-compare>
</intl-collator>
<hr>
<intl-collator locales="fr" option-usage="search" option-sensitivity="base">
<intl-collator-compare>
<data slot="target" value="congres"></data>
<ol slot="list">
<li>Congrès</li>
<li>congres</li>
<li>Assemblée</li>
<li>poisson</li>
</ol>
</intl-collator-compare>
</intl-collator>
<script type="module">
import {defineIntlElements} from './dist/index.js';
// import {defineIntlElements} from 'https://esm.sh/intl-elements?bundle';
defineIntlElements();
</script>
</html>