-
Notifications
You must be signed in to change notification settings - Fork 126
/
languages.html
89 lines (79 loc) · 3.24 KB
/
languages.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>LaTeX.css — Language Support</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>
<span class="latex">L<span>a</span>T<span>e</span>X</span>.css Language
Support
</h1>
<div class="abstract">
<h5>Abstract</h5>
<p>
LaTeX.css prefixes elements with a class name of
<a href="/#tdpl">theorem, definition, lemma or proof</a> with a
corresponding label. They are in English by default, but it is possible
to change it to a
<a href="https://github.com/vincentdoerig/latex-css/tree/master/lang">supported language</a>,
by setting the <code>lang</code> attribute to the desired language code
and importing the corresponding language file (<code><link rel="stylesheet" href="https://latex.vercel.app/lang/[lang].css"
/></code>) in addition to the main stylesheet.
</p>
</div>
<article>
<p>
Here is a quick demo demonstrating LaTeX.css' language support. If want
to support a language that isn't listed here, feel free to open a PR/issue on
<a href="https://github.com/vincentdoerig/latex-css">GitHub</a>.
</p>
<label for="language-select">Choose a language:</label>
<select name="language" id="language-select">
<option value="en">English (en)</option>
<!-- ↓ Sort alphabetically ↓ -->
<option value="cs">Czech (cs)</option>
<option value="de">German (de)</option>
<option value="da">Danish (da)</option>
<option value="es">Spanish (es)</option>
<option value="fr">French (fr)</option>
<option value="hu">Hungarian (hu)</option>
<option value="it">Italian (it)</option>
<option value="ja">Japanese (ja)</option>
<option value="mwl">Mirandese (mwl)</option>
<option value="nl">Dutch (nl)</option>
<option value="pl">Polish (pl)</option>
<option value="pt">Portuguese (pt)</option>
<option value="ro">Romanian (ro)</option>
<option value="ru">Russian (ru)</option>
<option value="sl">Slovenian (sl)</option>
<option value="sv">Swedish (sv)</option>
<option value="tr">Turkish (tr)</option>
<option value="zh-hans">Simplified Chinese (zh-hans)</option>
<option value="zh-hant">Traditional Chinese (zh-hant)</option>
</select>
<div id="wrapper">
<div class="theorem">Hello, I'm a theorem.</div>
<div class="definition">This is a definition.</div>
<div class="lemma">And this is a lemma.</div>
<div class="proof">And we also got a proof.</div>
</div>
</article>
<script>
const selection = document.getElementById('language-select');
const wrapper = document.getElementById('wrapper');
selection.addEventListener('change', () => {
const selectedLanguage = selection.options[selection.selectedIndex].value;
wrapper.lang = selectedLanguage;
if (selectedLanguage !== 'en') {
const link = document.createElement('link');
link.setAttribute('rel', "stylesheet");
link.setAttribute('href', `lang/${selectedLanguage}.css`);
document.head.appendChild(link);
}
});
</script>
</body>
</html>