-
-
Notifications
You must be signed in to change notification settings - Fork 63
/
index.html
45 lines (38 loc) · 1.56 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
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/i18next@23.2.1/i18next.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery-i18next@1.2.1/jquery-i18next.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/i18next-http-backend@2.2.1/i18nextHttpBackend.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/i18next-browser-languagedetector@7.1.0/i18nextBrowserLanguageDetector.min.js"></script>
</head>
<body>
<ul class="nav">
<li><a href="#" data-i18n="nav.home"></a></li>
<li><a href="#" data-i18n="nav.page1"></a></li>
<li><a href="#" data-i18n="nav.page2"></a></li>
</ul>
<div class="content">
<input data-i18n="[placeholder]input.placeholder; [title]input.placeholder" />
</div>
<script>
i18next.use(i18nextBrowserLanguageDetector).use(i18nextHttpBackend).init({
debug: true,
fallbackLng: 'en',
// if you want to customize a different translation path,
// use the loadPath option:
backend: {
loadPath: '/locales/{{lng}}/{{ns}}.json'
}
}, function(err, t) {
// for options see
// https://github.com/i18next/jquery-i18next#initialize-the-plugin
jqueryI18next.init(i18next, $);
// start localizing, details:
// https://github.com/i18next/jquery-i18next#usage-of-selector-function
$('.nav').localize();
$('.content').localize();
});
</script>
</body>
</html>