-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessage.html
102 lines (98 loc) · 3.26 KB
/
message.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>intl-message demo</title>
<style>
html { font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji; }
p > span, p > intl-message { display: block }
intl-message { font-weight: bold; }
</style>
</head>
<body>
<h1>intl-message demo</h1>
<button onclick="i18next.changeLanguage('en-GB')">en-GB</button>
<button onclick="i18next.changeLanguage('en-US')">en-US</button>
<button onclick="i18next.changeLanguage('fr')">fr</button>
<p>
<span><intl-message label="undefined.key"></span>
<intl-message label="undefined.key"></intl-message>
</p>
<p>
<span><intl-message label="test:key"></span>
<intl-message label="test:key"></intl-message>
</p>
<p>
<span><intl-message label="title" value="Title"></span>
<intl-message label="title" value="Title"></intl-message>
</p>
<p>
<span><intl-message label="deep" value='{"key":"Hello","val":"World"}'></span>
<intl-message label="deep" value='{"key":"Hello","val":"World"}'></intl-message>
</p>
<p>
<span><intl-message label="html" value="<span style='color: red'>dangerous</span>"></span>
<intl-message label="html" value="<span style='color: red'>dangerous</span>"></intl-message>
</p>
<p>
<span><intl-message label="html" dangerous value="<span style='color: red'>dangerous</span>"></span>
<intl-message label="html" dangerous value="<span style='color: red'>dangerous</span>"></intl-message>
</p>
<p>
<span><intl-message label="item" count="1"></span>
<intl-message label="item" count="1"></intl-message>
</p>
<p>
<span><intl-message label="item" count="10"></span>
<intl-message label="item" count="10"></intl-message>
</p>
<!-- always load i18next first -->
<script src="https://unpkg.com/i18next@19/i18next.min.js"></script>
<script src="https://unpkg.com/i18next-wc/dist/intl-message.js"></script>
<!-- <script src="../dist/intl-message.js"></script> -->
<script>
i18next.init({
lng: "en",
fallbackLng: "en",
resources: {
en: {
default: {
title: "My {{value}}",
deep: "In English: {{value.key}} {{value.val}}!",
html: "With HTML it might get {{value}}",
item: "One item",
item_plural: "{{count}} items",
placeholder: 'fill in here',
'Selected language': 'Selected language:'
},
test: {
key: "A value"
}
},
'en-US': {
default: {
deep: "In US English: {{value.key}} {{value.val}}!"
}
},
fr: {
default: {
title: "Mon {{value}}",
deep: "En anglais: {{value.key}} {{value.val}} !",
html: "Avec le HTML, cela pourrait devenir {{value}}",
item: "Un seul article",
item_plural: "{{count}} articles",
placeholder: 'remplir ici',
'Selected language': 'Langue choisie :'
},
test: {
key: "une valeur"
}
}
},
defaultNS: "default",
fallbackNS: "global"
})
</script>
<script src="iframeheight.js"></script>
</body>
</html>