forked from Elara6331/itd
Add transliteration
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/viper"
|
||||
"go.arsenm.dev/infinitime"
|
||||
"go.arsenm.dev/itd/translit"
|
||||
)
|
||||
|
||||
func initNotifRelay(dev *infinitime.Device) error {
|
||||
@@ -71,6 +72,13 @@ func initNotifRelay(dev *infinitime.Device) error {
|
||||
continue
|
||||
}
|
||||
|
||||
maps := viper.GetStringSlice("notifs.translit.maps.use")
|
||||
translit.Maps["custom"] = viper.GetStringSlice("notifs.translit.maps.custom")
|
||||
replacer := translit.NewReplacer(maps...)
|
||||
sender = replacer.Replace(sender)
|
||||
summary = replacer.Replace(summary)
|
||||
body = replacer.Replace(body)
|
||||
|
||||
var msg string
|
||||
// If summary does not exist, set message to body.
|
||||
// If it does, set message to summary, two newlines, and then body
|
||||
|
||||
Reference in New Issue
Block a user