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 $.SourceLanguages $.SourceLanguage}})</option>
|
---|
39 | {{else }}
|
---|
40 | <option value="{{ $code }}" {{if eq $code $.From}}selected{{end}}>{{ $name }}</option>
|
---|
41 | {{end}}
|
---|
42 | {{end}}
|
---|
43 | </select>
|
---|
44 | </div>
|
---|
45 |
|
---|
46 | <div class="switch_languages">
|
---|
47 | <button id="switchbutton" aria-label="Switch languages"
|
---|
48 | formaction="/switchlanguages/?engine={{ .Engine }}" type="submit"><-></button>
|
---|
49 | </div>
|
---|
50 |
|
---|
51 | <div class="language">
|
---|
52 | <select name="to" aria-label="Target language">
|
---|
53 | {{range $code, $name := .TargetLanguages}}
|
---|
54 | <option value="{{ $code }}" {{if eq $code $.To}}selected{{end}}>{{ $name }}</option>
|
---|
55 | {{end}}
|
---|
56 | </select>
|
---|
57 | </div>
|
---|
58 | </div>
|
---|
59 |
|
---|
60 | <div class="wrap">
|
---|
61 | <div class="item-wrapper">
|
---|
62 | <textarea autofocus class="item" id="input" name="text" dir="auto"
|
---|
63 | placeholder="Enter Text Here">{{ .OriginalText }}</textarea>
|
---|
64 | {{if .TtsFrom}}
|
---|
65 | <audio controls>
|
---|
66 | <source type="audio/mpeg" src="{{ .TtsFrom }}">
|
---|
67 | </audio>
|
---|
68 | {{end}}
|
---|
69 | </div>
|
---|
70 |
|
---|
71 | <div class="item-wrapper">
|
---|
72 | <textarea id="output" class="translation item" dir="auto" placeholder="Translation"
|
---|
73 | readonly>{{.Translation.TranslatedText}}</textarea>
|
---|
74 | {{if .TtsTo}}
|
---|
75 | <audio controls>
|
---|
76 | <source type="audio/mpeg" src="{{ .TtsTo }}">
|
---|
77 | </audio>
|
---|
78 | {{end}}
|
---|
79 | </div>
|
---|
80 | </div>
|
---|
81 |
|
---|
82 | <br>
|
---|
83 |
|
---|
84 | <div class="center">
|
---|
85 | <button type="submit">Translate with {{ index .enginesNames .Engine }}!</button>
|
---|
86 | </div>
|
---|
87 |
|
---|
88 | <br>
|
---|
89 |
|
---|
90 | <div id="definitions_and_translations">
|
---|
91 | {{ if .Translation.Definitions }}
|
---|
92 | <div class="definitions">
|
---|
93 | {{ range $type, $definitions :=.Translation.Definitions }}
|
---|
94 | <span class="def_type">{{ $type }}</span>
|
---|
95 | <ol>
|
---|
96 | {{ range $definition_item := $definitions }}
|
---|
97 | <li>
|
---|
98 | {{ $definition_item.definition }}
|
---|
99 | <br>
|
---|
100 | {{with $definition_item.use_in_sentence}}
|
---|
101 | <span class="use_in_sentence">"{{$definition_item.use_in_sentence}}"</span>
|
---|
102 | <br>
|
---|
103 | {{end}}
|
---|
104 | {{with $definition_item.synonyms}}
|
---|
105 | {{ range $synonym_type, $_ := $definition_item.synonyms }}
|
---|
106 | <span class="syn">
|
---|
107 | {{if $synonym_type }}
|
---|
108 | <br>
|
---|
109 | <span class="syn_type">{{$synonym_type}}: </span>{{end}}{{ range $index, $element := index
|
---|
110 | $definition_item.synonyms $synonym_type}}{{if $index}}, {{end}}{{$element}}{{end}}
|
---|
111 | </span>
|
---|
112 | {{end}}
|
---|
113 | {{end}}
|
---|
114 | </li>
|
---|
115 | {{end}}
|
---|
116 | </ol>
|
---|
117 | {{end}}
|
---|
118 | </div>
|
---|
119 | {{ end}}
|
---|
120 |
|
---|
121 | {{ if .Translation.Translations }}
|
---|
122 | <div class="translations">
|
---|
123 | {{ range $def_type, $translations := .Translation.Translations }}
|
---|
124 | <span class="def_type">{{ $def_type }}</span>
|
---|
125 | <ul>
|
---|
126 | {{ range $word, $word_translations := $translations }}
|
---|
127 | <li>
|
---|
128 | <span class="syn_type">{{$word}}:</span>
|
---|
129 | <span class="syn">{{ range $index, $element := $word_translations.words}}{{if $index}}, {{end}}{{$element}}{{end}}</span>
|
---|
130 | <span class="syn_type">{{$word_translations.frequency}}</span>
|
---|
131 | </li>
|
---|
132 | <br>
|
---|
133 | {{end}}
|
---|
134 | </ul>
|
---|
135 | {{end}}
|
---|
136 | </div>
|
---|
137 | {{end}}
|
---|
138 | </div>
|
---|
139 |
|
---|
140 | </form>
|
---|
141 | <script src="/static/script.js"></script>
|
---|
142 | </body>
|
---|
143 |
|
---|
144 | </html>
|
---|