This commit is contained in:
Yun
2024-06-30 11:52:34 +08:00
commit cf9ac56b88
6 changed files with 255 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
package langx
type options struct {
defaultCode int
defaultLang string
replaceKey string
}
func defaultOptions() *options {
return &options{
defaultCode: 200,
defaultLang: "zh",
replaceKey: "#%s#",
}
}
type Option func(*options)
func SetDefaultCode(code int) Option {
return func(o *options) {
o.defaultCode = code
}
}
func SetDefaultLanguage(lang string) Option {
return func(o *options) {
o.defaultLang = lang
}
}
func SetReplaceKey(key string) Option {
return func(o *options) {
o.replaceKey = key
}
}