mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-04-11 17:47:20 +10:00
platform: Fix set local
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
C "github.com/sagernet/sing-box/constant"
|
C "github.com/sagernet/sing-box/constant"
|
||||||
@@ -13,6 +14,7 @@ import (
|
|||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
"github.com/sagernet/sing-box/service/oomkiller"
|
"github.com/sagernet/sing-box/service/oomkiller"
|
||||||
"github.com/sagernet/sing/common/byteformats"
|
"github.com/sagernet/sing/common/byteformats"
|
||||||
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -97,8 +99,14 @@ func Setup(options *SetupOptions) error {
|
|||||||
return redirectStderr(filepath.Join(sWorkingPath, "CrashReport-"+sCrashReportSource+".log"))
|
return redirectStderr(filepath.Join(sWorkingPath, "CrashReport-"+sCrashReportSource+".log"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetLocale(localeId string) {
|
func SetLocale(localeId string) error {
|
||||||
locale.Set(localeId)
|
if strings.Contains(localeId, "@") {
|
||||||
|
localeId = strings.Split(localeId, "@")[0]
|
||||||
|
}
|
||||||
|
if !locale.Set(localeId) {
|
||||||
|
return E.New("unsupported locale: ", localeId)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Version() string {
|
func Version() string {
|
||||||
|
|||||||
Reference in New Issue
Block a user