From 6c2bdb0c9cc9ec2e2b4f2b432b5b242f347c4055 Mon Sep 17 00:00:00 2001 From: spectatorNan Date: Wed, 31 Jul 2024 03:30:16 +0800 Subject: [PATCH] fix: next rpc svc fetch lang failed --- goi18nx/rpc_interceptor.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/goi18nx/rpc_interceptor.go b/goi18nx/rpc_interceptor.go index 17d39e2..e0c29ce 100644 --- a/goi18nx/rpc_interceptor.go +++ b/goi18nx/rpc_interceptor.go @@ -43,5 +43,9 @@ func (i *I18nGrpcInterceptor) saveLocalize(ctx context.Context) (context.Context langTag := MatchCurrentLanguageTag(lang, i.supportTags) bundle := NewBundle(langTag, i.localizationFiles...) localizer := i18n2.NewLocalizer(bundle, lang) - return setLocalizer(ctx, localizer), nil + ctx = setLocalizer(ctx, localizer) + + // Append the language metadata to the outgoing context + ctx = metadata.AppendToOutgoingContext(ctx, defaultLangHeaderKey, lang) + return ctx, nil }