1 | <!doctype html>
|
---|
2 | <html lang="en">
|
---|
3 |
|
---|
4 | <head>
|
---|
5 | <title>SimplyTranslate</title>
|
---|
6 | <link rel="shortcut icon" href="/static/favicon.ico">
|
---|
7 | <meta name="description" content="Experience simple and private Google translations">
|
---|
8 | <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
---|
9 | <meta charset="UTF-8">
|
---|
10 | <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'">
|
---|
11 | <meta name="referrer" content="no-referrer">
|
---|
12 | <link rel="stylesheet" href="/static/style.css">
|
---|
13 | </head>
|
---|
14 |
|
---|
15 | <body>
|
---|
16 | <header class="center">
|
---|
17 | <h1>SimplyTranslate</h1>
|
---|
18 | </header>
|
---|
19 |
|
---|
20 | <form action="/?engine={{.Engine}}" method="POST" id="translation-form">
|
---|
21 |
|
---|
22 | <div class="center">
|
---|
23 | Translation Engine
|
---|
24 | {{$i := 0}}
|
---|
25 | {{ range $k, $v := .enginesNames }}
|
---|
26 | <a {{ if eq $k $.Engine }}style="text-decoration:underline" {{end}} href="/?engine={{ $k }}">{{ $v }}</a>
|
---|
27 | {{$i = (inc $i)}}
|
---|
28 | {{if eq $i (len $.enginesNames)}}{{else}}|{{end}}
|
---|
29 | {{end}}
|
---|
30 | </div>
|
---|
31 | <br>
|
---|
32 |
|
---|
33 | <div class="wrap languages">
|
---|
34 | <div class="language">
|
---|
35 | <select name="from" aria-label="Source language">
|
---|
36 | {{range $code, $name := .SourceLanguages}}
|
---|
37 | {{if and (eq $code "auto") $.SourceLanguage}}
|
---|
38 | <option value="{{ $code }}" {{if eq $code $.From}}selected{{end}}>{{ $name }} ({{index
|
---|
39 | $.SourceLanguages $.SourceLanguage}})</option>
|
---|
40 | {{else }}
|
---|
41 | <option value="{{ $code }}" {{if eq $code $.From}}selected{{end}}>{{ $name }}</option>
|
---|
42 | {{end}}
|
---|
43 | {{end}}
|
---|
44 | </select>
|
---|
45 | </div>
|
---|
46 |
|
---|
47 | <div class="switch_languages">
|
---|
48 | <button id="switchbutton" aria-label="Switch languages"
|
---|
49 | formaction="/switchlanguages/?engine={{ .Engine }}" type="submit"><-></button>
|
---|
50 | </div>
|
---|
51 |
|
---|
52 | <div class="language">
|
---|
53 | <select name="to" aria-label="Target language">
|
---|
54 | {{range $code, $name := .TargetLanguages}}
|
---|
55 | <option value="{{ $code }}" {{if eq $code $.To}}selected{{end}}>{{ $name }}</option>
|
---|
56 | {{end}}
|
---|
57 | </select>
|
---|
58 | </div>
|
---|
59 | </div>
|
---|
60 |
|
---|
61 | <div class="wrap">
|
---|
62 | <div class="item-wrapper">
|
---|
63 | <textarea autofocus class="item" id="input" name="text" dir="auto"
|
---|
64 | placeholder="Enter Text Here">{{ .OriginalText }}</textarea>
|
---|
65 | {{if .TtsFrom}}
|
---|
66 | <audio controls>
|
---|
67 | <source type="audio/mpeg" src="{{ .TtsFrom }}">
|
---|
68 | </audio>
|
---|
69 | {{end}}
|
---|
70 | </div>
|
---|
71 |
|
---|
72 | <div class="item-wrapper">
|
---|
73 | <textarea id="output" class="translation item" dir="auto" placeholder="Translation"
|
---|
74 | readonly>{{.Translation.TranslatedText}}</textarea>
|
---|
75 | {{if .TtsTo}}
|
---|
76 | <audio controls>
|
---|
77 | <source type="audio/mpeg" src="{{ .TtsTo }}">
|
---|
78 | </audio>
|
---|
79 | {{end}}
|
---|
80 | </div>
|
---|
81 | </div>
|
---|
82 |
|
---|
83 | <br>
|
---|
84 |
|
---|
85 | <div class="center">
|
---|
86 | <button type="submit">Translate with {{ index .enginesNames .Engine }}!</button>
|
---|
87 | </div>
|
---|
88 |
|
---|
89 | <br>
|
---|
90 |
|
---|
91 | <div id="definitions_and_translations">
|
---|
92 | {{ if .Translation.Definitions }}
|
---|
93 | <div class="definitions">
|
---|
94 | {{ range $type, $definitions :=.Translation.Definitions }}
|
---|
95 | <span class="def_type">{{ $type }}</span>
|
---|
96 | <ol>
|
---|
97 | {{ range $definition_item := $definitions }}
|
---|
98 | <li>
|
---|
99 | {{ $definition_item.definition }}
|
---|
100 | <br>
|
---|
101 | {{with $definition_item.use_in_sentence}}
|
---|
102 | <span class="use_in_sentence">"{{$definition_item.use_in_sentence}}"</span>
|
---|
103 | <br>
|
---|
104 | {{end}}
|
---|
105 | {{with $definition_item.synonyms}}
|
---|
106 | {{ range $synonym_type, $_ := $definition_item.synonyms }}
|
---|
107 | <span class="syn">
|
---|
108 | {{if $synonym_type }}
|
---|
109 | <br>
|
---|
110 | <span class="syn_type">{{$synonym_type}}: </span>{{end}}{{ range $index, $element := index
|
---|
111 | $definition_item.synonyms $synonym_type}}{{if $index}}, {{end}}{{$element}}{{end}}
|
---|
112 | </span>
|
---|
113 | {{end}}
|
---|
114 | {{end}}
|
---|
115 | </li>
|
---|
116 | {{end}}
|
---|
117 | </ol>
|
---|
118 | {{end}}
|
---|
119 | </div>
|
---|
120 | {{ end}}
|
---|
121 |
|
---|
122 | {{ if .Translation.Translations }}
|
---|
123 | <div class="translations">
|
---|
124 | {{ range $def_type, $translations := .Translation.Translations }}
|
---|
125 | <span class="def_type">{{ $def_type }}</span>
|
---|
126 | <ul>
|
---|
127 | {{ range $word, $word_translations := $translations }}
|
---|
128 | <li>
|
---|
129 | <span class="syn_type">{{$word}}:</span>
|
---|
130 | <span class="syn">{{ range $index, $element := $word_translations.words}}{{if $index}},
|
---|
131 | {{end}}{{$element}}{{end}}</span>
|
---|
132 | <span class="syn_type">{{$word_translations.frequency}}</span>
|
---|
133 | </li>
|
---|
134 | <br>
|
---|
135 | {{end}}
|
---|
136 | </ul>
|
---|
137 | {{end}}
|
---|
138 | </div>
|
---|
139 | {{end}}
|
---|
140 | </div>
|
---|
141 |
|
---|
142 | </form>
|
---|
143 | <br><br><br><br><br>
|
---|
144 | <footer class="center">
|
---|
145 | <a href="https://codeberg.org/ManeraKai/simplytranslate">Source Code</a>
|
---|
146 | </footer>
|
---|
147 |
|
---|
148 | <script src="/static/script.js"></script>
|
---|
149 | </body>
|
---|
150 |
|
---|
151 | </html>
|
---|