tren/extract/dictionary.go
ngn 4df8b90dae
All checks were successful
Build and publish the docker image / build (push) Successful in 58s
initial commit
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-05 09:58:58 +03:00

32 lines
726 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
}