tren/extract/dictionary.go
ngn 7755d6c2fe
All checks were successful
Build and publish the docker image / build (push) Successful in 1m2s
fix code formatting
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-05 23:51:03 +03:00

32 lines
717 B
Go

package extract
import "net/url"
type dictionary struct {
ShortName string
Name string
Url string
}
var Dicts []dictionary = []dictionary{
{ShortName: "EN-TR", Name: "Turkish - English", Url: "/turkish-english"},
{ShortName: "EN-DE", Name: "German - English", Url: "/german-english"},
{ShortName: "EN-ES", Name: "Spanish - English", Url: "/spanish-english"},
{ShortName: "EN-FR", Name: "French - English", Url: "/french-english"},
}
func find_dict(sn string) *dictionary {
for i := range Dicts {
if Dicts[i].ShortName == sn {
return &Dicts[i]
}
}
return nil
}
func (d *dictionary) Path(term string) string {
term_escaped := url.PathEscape(term)
return d.Url + "/" + term_escaped
}