save the provided dictionary accross translations
All checks were successful
Build and publish the docker image / build (push) Successful in 38s

Signed-off-by: ngn <ngn@ngn.tf>
This commit is contained in:
ngn 2025-04-05 10:30:59 +03:00
parent 76db84f69c
commit 15ffbfae4d
Signed by: ngn
GPG Key ID: A3654DF5AD9F641D
3 changed files with 8 additions and 5 deletions

View File

@ -39,6 +39,7 @@ func POST_translate(c *fiber.Ctx) error {
return util.Render(c, "translate", fiber.Map{ return util.Render(c, "translate", fiber.Map{
"term": form.Term, "term": form.Term,
"dictionary": form.Dictionary,
"fields": trans.Fields, "fields": trans.Fields,
"entries": trans.Entries, "entries": trans.Entries,
"suggestions": trans.Suggestions, "suggestions": trans.Suggestions,

View File

@ -6,8 +6,12 @@
{{end}} {{end}}
<select name="dictionary"> <select name="dictionary">
{{range .dictionaries}} {{range .dictionaries}}
{{if and ($.dictionary) (eq $.dictionary .ShortName)}}
<option value="{{.ShortName}}" selected>{{.Name}}</option>
{{else}}
<option value="{{.ShortName}}">{{.Name}}</option> <option value="{{.ShortName}}">{{.Name}}</option>
{{end}} {{end}}
{{end}}
</select> </select>
<button type="submit">Translate</button> <button type="submit">Translate</button>
</form> </form>

View File

@ -8,11 +8,9 @@
<main> <main>
{{template "search" .}} {{template "search" .}}
{{if not .suggestions}} {{if and (not .suggestions) (not .fields)}}
{{if not .fields}}
<h3 class="result">No results :(</h3> <h3 class="result">No results :(</h3>
{{end}} {{end}}
{{end}}
{{if .suggestions}} {{if .suggestions}}
<h3 class="result">Did you mean...</h3> <h3 class="result">Did you mean...</h3>