mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-12-27 18:35:38 +08:00
31 lines
688 B
Go
31 lines
688 B
Go
|
package locale
|
||
|
|
||
|
var (
|
||
|
localeRegistry = make(map[string]*Locale)
|
||
|
current = defaultLocal
|
||
|
)
|
||
|
|
||
|
type Locale struct {
|
||
|
// deprecated messages for graphical clients
|
||
|
DeprecatedMessage string
|
||
|
DeprecatedMessageNoLink string
|
||
|
}
|
||
|
|
||
|
var defaultLocal = &Locale{
|
||
|
DeprecatedMessage: "%s is deprecated in sing-box %s and will be removed in sing-box %s please checkout documentation for migration.",
|
||
|
DeprecatedMessageNoLink: "%s is deprecated in sing-box %s and will be removed in sing-box %s.",
|
||
|
}
|
||
|
|
||
|
func Current() *Locale {
|
||
|
return current
|
||
|
}
|
||
|
|
||
|
func Set(localeId string) bool {
|
||
|
locale, loaded := localeRegistry[localeId]
|
||
|
if !loaded {
|
||
|
return false
|
||
|
}
|
||
|
current = locale
|
||
|
return true
|
||
|
}
|