mirror of
https://github.com/hrfee/jfa-go.git
synced 2026-01-18 16:47:42 +01:00
messages: custom content described in customcontent.go, message tests
customcontent.go constains a structure with all the custom content, methods for getting display names, subjects, etc., and a list of variables, conditionals, and placeholder values. Tests for constructX methods included in email_test.go, and all jfa-go tests can be run with make INTERNAL=off test.
This commit is contained in:
10
lang.go
10
lang.go
@@ -1,6 +1,10 @@
|
||||
package main
|
||||
|
||||
import "github.com/hrfee/jfa-go/common"
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hrfee/jfa-go/common"
|
||||
)
|
||||
|
||||
type langMeta struct {
|
||||
Name string `json:"name"`
|
||||
@@ -166,7 +170,7 @@ func (ts *telegramLangs) getOptions() []common.Option {
|
||||
}
|
||||
|
||||
type langSection map[string]string
|
||||
type tmpl map[string]string
|
||||
type tmpl = map[string]any
|
||||
|
||||
func templateString(text string, vals tmpl) string {
|
||||
start, previousEnd := -1, -1
|
||||
@@ -183,7 +187,7 @@ func templateString(text string, vals tmpl) string {
|
||||
start = -1
|
||||
continue
|
||||
}
|
||||
out += text[previousEnd+1:start] + val
|
||||
out += text[previousEnd+1:start] + fmt.Sprint(val)
|
||||
previousEnd = i
|
||||
start = -1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user