Files
ai-agent/internal/pkg/i18nx/context.go
T
mlogclub b128447a7e Refactor localization strings to English across various services and UI components
- Updated titles and subtitles in channel_service.go for web channel and WeChat MP channel configurations.
- Changed handoff messages in conversation_human_dispatch_service.go to English.
- Modified notification messages in event handlers for ticket and conversation assignments to English.
- Adjusted ticket creation messages in ticket_service.go to reflect English localization.
- Updated default locale settings in i18n configuration files to English (en-US).
- Changed HTML language attribute in layout.tsx to English.
- Refactored widget locale detection logic in agent-desk-sdk.ts to prioritize English.
2026-05-31 21:57:31 +08:00

28 lines
483 B
Go

package i18nx
import "github.com/gin-gonic/gin"
const contextLocaleKey = "i18nx.locale"
func Locale(ctx *gin.Context) string {
if ctx == nil {
return DefaultLocale
}
value, ok := ctx.Get(contextLocaleKey)
if !ok {
return DefaultLocale
}
locale, ok := value.(string)
if !ok {
return DefaultLocale
}
return NormalizeLocale(locale)
}
func SetLocale(ctx *gin.Context, locale string) {
if ctx == nil {
return
}
ctx.Set(contextLocaleKey, NormalizeLocale(locale))
}