优化逻辑

This commit is contained in:
Yun
2024-11-10 22:28:02 +08:00
parent f66e76883f
commit 7eaf21634c
11 changed files with 54 additions and 33 deletions
+7 -7
View File
@@ -4,7 +4,7 @@ type options struct {
defaultCode int
defaultLang string
replaceKey string
ctxLangKey string
// ctxLangKey string
}
func defaultOptions() *options {
@@ -12,7 +12,7 @@ func defaultOptions() *options {
defaultCode: 200,
defaultLang: "zh",
replaceKey: "#%s#",
ctxLangKey: "language",
// ctxLangKey: "language",
}
}
@@ -33,11 +33,11 @@ func SetDefaultCode(code int) Option {
}
// 从ctx里面获取语言的key
func SetCtxLangKey(key string) Option {
return func(o *options) {
o.ctxLangKey = key
}
}
// func SetCtxLangKey(key string) Option {
// return func(o *options) {
// o.ctxLangKey = key
// }
// }
// 默认语言
func SetDefaultLanguage(lang string) Option {