Skip to content

Commit

Permalink
If it is a MAC system, skip the global configuration internationaliza…
Browse files Browse the repository at this point in the history
…tion information (#3429)
  • Loading branch information
kakj-go authored Dec 21, 2021
1 parent 6a7e437 commit 53400d2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/i18n/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package i18n
import (
"context"
"net/http"
"runtime"

"github.com/erda-project/erda/pkg/goroutine_context"
)
Expand All @@ -41,6 +42,11 @@ func GetLocaleNameByRequest(request *http.Request) string {
}

func GetGoroutineBindLang() string {
// mac system use goroutine_context.GetContext() will panic
if runtime.GOOS == "darwin" {
return ""
}

globalContext := goroutine_context.GetContext()
if globalContext == nil {
return ""
Expand All @@ -58,6 +64,11 @@ func GetGoroutineBindLang() string {
}

func SetGoroutineBindLang(localeName string) {
// mac system use goroutine_context.GetContext() will panic
if runtime.GOOS == "darwin" {
return
}

ctx := goroutine_context.GetContext()
if ctx == nil {
ctx = context.Background()
Expand Down

0 comments on commit 53400d2

Please sign in to comment.