Compare commits

..

2 Commits

Author SHA1 Message Date
f9922cbbc9
go.sum didnt update for some reason
All checks were successful
mozhi pipeline / Push Docker image to Codeberg docker registry (push) Successful in 40m18s
mozhi pipeline / Build and publish artifacts (push) Successful in 1h54m53s
2024-05-22 17:44:05 +05:30
35191f6ca9
add support for yandex alternative words and synonyms 2024-05-22 17:36:52 +05:30
6 changed files with 116 additions and 8 deletions

2
go.mod
View File

@ -7,7 +7,7 @@ replace github.com/OwO-Network/gdeeplx => github.com/gi-yt/gdeeplx v0.0.0-202308
//replace codeberg.org/aryak/libmozhi => /home/arya/projects/mozhi/libmozhi //replace codeberg.org/aryak/libmozhi => /home/arya/projects/mozhi/libmozhi
require ( require (
codeberg.org/aryak/libmozhi v0.0.0-20240414131012-697ab3b7bb29 codeberg.org/aryak/libmozhi v0.0.0-20240522120450-090c25dcb721
github.com/gofiber/fiber/v2 v2.52.4 github.com/gofiber/fiber/v2 v2.52.4
github.com/gofiber/swagger v1.0.0 github.com/gofiber/swagger v1.0.0
github.com/gofiber/template v1.8.0 github.com/gofiber/template v1.8.0

2
go.sum
View File

@ -47,6 +47,8 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
codeberg.org/aryak/libmozhi v0.0.0-20240414131012-697ab3b7bb29 h1:lIGbJiXpRmb9doPiiQ2eB9zMZCpk5oEyJC9f4iuKeYA= codeberg.org/aryak/libmozhi v0.0.0-20240414131012-697ab3b7bb29 h1:lIGbJiXpRmb9doPiiQ2eB9zMZCpk5oEyJC9f4iuKeYA=
codeberg.org/aryak/libmozhi v0.0.0-20240414131012-697ab3b7bb29/go.mod h1:X3kF1lzpbtHzJZUpPgNl9eJG70fskeqjuJYVHz+uNSo= codeberg.org/aryak/libmozhi v0.0.0-20240414131012-697ab3b7bb29/go.mod h1:X3kF1lzpbtHzJZUpPgNl9eJG70fskeqjuJYVHz+uNSo=
codeberg.org/aryak/libmozhi v0.0.0-20240522120450-090c25dcb721 h1:ZQ/tqILWJvFRZzVhdYXaHxJyBWdtcMiKB/yu79vHdhY=
codeberg.org/aryak/libmozhi v0.0.0-20240522120450-090c25dcb721/go.mod h1:X3kF1lzpbtHzJZUpPgNl9eJG70fskeqjuJYVHz+uNSo=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=

View File

@ -262,7 +262,7 @@ button:hover {
select, select,
.nice-select .nice-select-dropdown, .nice-select .nice-select-dropdown,
.nice-select, .nice-select,
.nice-select-search{ .nice-select-search {
background-color: #fff; background-color: #fff;
color: #2f2f2f; color: #2f2f2f;
} }
@ -284,4 +284,68 @@ button:hover {
footer { footer {
border-top: 1px solid #b2b2b2; border-top: 1px solid #b2b2b2;
} }
.def_type {
color: cyan;
text-transform: capitalize;
}
.syn {
color: burlywood;
}
.syn_type {
color: cyan;
}
.use_in_sentence {
color: yellow;
}
}
#definitions_and_translations {
display: grid;
margin: auto;
width: 1100px;
gap: 10px;
grid-template-areas: "definitions translations";
}
.def_type {
color: #007979;
text-transform: capitalize;
}
.syn {
color: #804700;
}
.syn_type {
color: #007979;
}
.use_in_sentence {
color: #009902;
}
.definitions li:not(:last-child) {
margin-bottom: 1rem;
}
@media screen and (max-width: 1200px) {
#definitions_and_translations {
display: grid;
width: 90vw;
grid-template-areas:
"translations translations"
"definitions definitions";
}
}
div.definitions {
grid-area: definitions;
}
div.translations {
grid-area: translations;
} }

View File

@ -1,4 +1,4 @@
{{template "header" .}} {{ template "header" . }}
<main> <main>
<h1>About Mozhi</h1> <h1>About Mozhi</h1>
<h2>What is Mozhi?</h2> <h2>What is Mozhi?</h2>
@ -6,10 +6,7 @@
Mozhi is an alternative frontend for many translation engines such as Mozhi is an alternative frontend for many translation engines such as
google, yandex, duckduckgo, libretranslate and more! google, yandex, duckduckgo, libretranslate and more!
</p> </p>
<h2>Why would I use this over just directly accessing the engine in question</h2>
<h2>
Why would I use this over just directly accessing the engine in question
</h2>
<p> <p>
There are many reasons why using an alternative-frontend like mozhi is There are many reasons why using an alternative-frontend like mozhi is
superior to directly accessing the service in question, and the biggest and superior to directly accessing the service in question, and the biggest and
@ -23,4 +20,4 @@
the engines right in front of you is extremely useful. the engines right in front of you is extremely useful.
</p> </p>
</main> </main>
{{ template "footer" .}} {{ template "footer" . }}

View File

@ -140,6 +140,9 @@
{{ end }} {{ end }}
</div> </div>
</div> </div>
{{ if eq .Engine "yandex" }}
{{ template "yandex_extras" . }}
{{ end }}
</form> </form>
<script> <script>
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0 // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0

42
views/yandex_extras.html Normal file
View File

@ -0,0 +1,42 @@
{{ if .Translation.WordChoices }}
<div id="definitions_and_translations">
<div class="translations">
{{ if or .Translation.TargetSynonyms .Translation.SourceSynonyms }}
<span class="def_type">Synonyms</span>
<ul>
{{ if .Translation.TargetSynonyms }}
<li>
<span class="syn_type">{{.Translation.OutputText}}</span>
<span class="syn">{{ range $index, $key := .Translation.TargetSynonyms }}{{ if eq $key "" }}{{ else }}{{ if eq $index 0 }}{{ else }}, {{ end }}{{.}}{{ end }}{{ end }}</span>
</li>
<br>
{{ end }}
{{ if .Translation.SourceSynonyms }}
<li>
<span class="syn_type">{{.OriginalText}}</span>
<span class="syn">{{ range $index, $key := .Translation.SourceSynonyms }}{{ if eq $key "" }}{{ else }}{{ if eq $index 0 }}{{ else }}, {{ end }}{{.}}{{ end }}{{ end }}</span>
</li>
<br>
{{ end }}
</ul>
{{ end }}
</div>
<div class="definitions">
{{ range $key := .Translation.WordChoices }}
<span class="def_type">{{ $key.Word }}</span>
<ol>
{{ range $index, $key2 := $key.ExamplesSource }}
<li>
say or shout “hello”; greet someone.
<br>
<span class="use_in_sentence">{{ index $key.ExamplesSource $index }}</span>
<br>
<span class="use_in_sentence">{{ index $key.ExamplesTarget $index }}</span>
<br>
</li>
{{ end }}
</ol>
{{ end }}
</div>
</div>
{{ end }}