added lang support to all html templates and cleaned up template rendering

This commit is contained in:
partisan 2024-10-08 22:11:06 +02:00
parent 5dd3114e2d
commit d9d0301548
18 changed files with 645 additions and 410 deletions

View file

@ -6,11 +6,11 @@
{{ if .IsThemeDark }}
<meta name="darkreader-lock">
{{ end }}
<title>Search with Ocásek</title>
<title>{{ translate "search_page_title" }}</title>
<link rel="stylesheet" href="/static/css/style.css">
<link rel="stylesheet" href="/static/css/style-search.css">
<link rel="stylesheet" href="/static/css/{{.Theme}}.css">
<link rel="search" type="application/opensearchdescription+xml" title="Ocásek" href="/opensearch.xml">
<link rel="search" type="application/opensearchdescription+xml" title="{{ translate "site_name" }}" href="/opensearch.xml">
</head>
<body>
<script defer src="/static/js/autocomplete.js"></script>
@ -70,19 +70,19 @@
<button class="material-icons-round clickable settings-icon-link settings-icon-link-search">menu</button>
</div>
<div class="search-menu settings-menu-hidden">
<h2>Settings</h2>
<h2>{{ translate "settings" }}</h2>
<div class="settings-content">
<button id="settingsButton" onclick="window.location.href='/settings'">All settings</button> <!-- Well its unessesary to use js here but this menu will not work without js anyway -->
<button id="settingsButton" onclick="window.location.href='/settings'">{{ translate "all_settings" }}</button> <!-- Well its unessesary to use js here but this menu will not work without js anyway -->
<div class="theme-settings theme-mini-settings">
<p><span class="highlight">Current theme: </span> <span id="theme_name">{{.Theme}}</span></p>
<p><span class="highlight">{{ translate "current_theme" }}: </span> <span id="theme_name">{{.Theme}}</span></p>
<div class="themes-settings-menu">
<div><img class="view-image-search clickable" id="dark_theme" alt="Dark Theme" src="/static/images/dark.webp"></div>
<div><img class="view-image-search clickable" id="light_theme" alt="Light Theme" src="/static/images/light.webp"></div>
<div><img class="view-image-search clickable" id="dark_theme" alt="{{ translate "dark_theme" }}" src="/static/images/dark.webp"></div>
<div><img class="view-image-search clickable" id="light_theme" alt="{{ translate "light_theme" }}" src="/static/images/light.webp"></div>
</div>
</div>
<select class="lang" name="safe" id="safeSearchSelect">
<option value="disabled" {{if eq .Safe "disabled"}}selected{{end}}>Safe Search Off</option>
<option value="active" {{if eq .Safe "active"}}selected{{end}}>Safe Search On</option>
<option value="disabled" {{if eq .Safe "disabled"}}selected{{end}}>{{ translate "safe_search_off" }}</option>
<option value="active" {{if eq .Safe "active"}}selected{{end}}>{{ translate "safe_search_on" }}</option>
</select>
<select class="lang" name="site_lang" id="siteLanguageSelect">
{{range .LanguageOptions}}
@ -93,9 +93,9 @@
</div>
<form action="/search" class="search-container" method="post" autocomplete="off">
<div class="search-page-content">
<h1>Ocásek</h1>
<h1>{{ translate "site_name" }}</h1>
<div class="wrapper">
<input type="text" name="q" autofocus id="search-input"/> <!-- placeholder="Type to search..." -->
<input type="text" name="q" autofocus id="search-input"/> <!-- placeholder="{{ translate "type_to_search" }}" -->
<button id="search-wrapper-ico" class="material-icons-round" name="t" value="web" type="submit">search</button>
<div class="autocomplete">
<ul></ul>
@ -106,32 +106,32 @@
<div class="icon-button">
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="text">search</button>
<p>Web</p>
<p>{{ translate "web" }}</p>
</div>
<div class="icon-button">
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="image">image</button>
<p>Images</p>
<p>{{ translate "images" }}</p>
</div>
<div class="icon-button">
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="video">movie</button>
<p>Videos</p>
<p>{{ translate "videos" }}</p>
</div>
<div class="icon-button">
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="forum">forum</button>
<p>Forums</p>
<p>{{ translate "forums" }}</p>
</div>
<div class="icon-button">
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="map">map</button>
<p>Maps</p>
<p>{{ translate "maps" }}</p>
</div>
<div class="icon-button">
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="file">share</button>
<p>Torrents</p>
<p>{{ translate "torrents" }}</p>
</div>
</div>
</div>