Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If it is a MAC system, skip the global configuration internationalizttion information #3429

Merged
merged 1 commit into from
Dec 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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