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