mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 12:40:07 +00:00
feat: add i18n support
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -65,7 +64,7 @@ func createNotification(c *gin.Context) (uint64, error) {
|
||||
}
|
||||
// 未勾选跳过检查
|
||||
if !nf.SkipCheck {
|
||||
if err := ns.Send("这是测试消息"); err != nil {
|
||||
if err := ns.Send(singleton.Localizer.T("a test message")); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
@@ -104,7 +103,7 @@ func updateNotification(c *gin.Context) (any, error) {
|
||||
|
||||
var n model.Notification
|
||||
if err := singleton.DB.First(&n, id).Error; err != nil {
|
||||
return nil, fmt.Errorf("notification id %d does not exist", id)
|
||||
return nil, singleton.Localizer.ErrorT("notification id %d does not exist", id)
|
||||
}
|
||||
|
||||
n.Name = nf.Name
|
||||
@@ -123,7 +122,7 @@ func updateNotification(c *gin.Context) (any, error) {
|
||||
}
|
||||
// 未勾选跳过检查
|
||||
if !nf.SkipCheck {
|
||||
if err := ns.Send("这是测试消息"); err != nil {
|
||||
if err := ns.Send(singleton.Localizer.T("a test message")); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user