~yerinalexey/gtranslate

ref: 598ca5d15e9ad49fde3b9a74aebc53e5ee785714 gtranslate/templates/index.html -rw-r--r-- 2.0 KiB
598ca5d1Alexey Yerin web: add "Detect language" option 5 months ago
                                                                                
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
{{define "index"}}
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Translate</title>
    <meta name="description" content="Better interface for Google Translate that is lightweight and doesn't track you">
    <link rel="stylesheet" href="/static/style.css" />
  </head>
  <body>
    <h1 class="title">Translate</h1>

    <section class="main-section">
      <form action="/" method="POST" class="form">
        <div class="form__line">
          <div class="form__field">
            <label for="from" class="item form__label">
              From:
            </label>
            <select name="from" id="from" class="form__input">
              <option value="auto">Detect language</option>
              {{range $code, $name := $.Languages}}
              <option value="{{$code}}" {{if eq $code $.From}}selected{{end}}>
                {{$name|title}}
              </option>
              {{end}}
            </select>
          </div>

          <div class="form__field">
            <label for="to" class="item form__label">
              To:
            </label>
            <select name="to" id="to" class="form__input">
              {{range $code, $name := $.Languages}}
              <option value="{{$code}}" {{if eq $code $.To}}selected{{end}}>
                {{$name|title}}
              </option>
              {{end}}
            </select>
          </div>
        </div>

        <div class="form__line">
          <div class="form__field">
            <textarea name="text" class="form__textarea" placeholder="Text to translate">{{.Text}}</textarea>
          </div>
          <div class="form__field">
            <textarea class="form__textarea form__translation" placeholder="Translation will appear here" readonly>{{.Translation}}</textarea>
          </div>
        </div>

        <div class="form__field">
          <button type="submit" class="form__button">Translate!</button>
        </div>
      </form>
    </section>
  </body>
</html>
{{end}}