mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 01:27:32 +00:00
feat: localized messages (#328)
* fix: project by id loads project from view and from eventstore * fix: correct search key for role * feat(auth): my user changes * fix: improve error handling in change converters * fix: log-id * feat(translations): event type translations * feat: localized translations * fix(translations): correct yaml format * chore: example * fix: remove unused code * correct checkSSL in sql * chore(modules): update * chore: refactor interceptors * fix: improvments * Update internal/static/i18n/de.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/de.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/de.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/de.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/de.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/de.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/en.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/en.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/en.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/en.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/en.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/de.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/de.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/de.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/de.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/de.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/de.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/de.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/de.yaml Co-authored-by: Florian Forster <florian@caos.ch> * Update internal/static/i18n/en.yaml Co-authored-by: Florian Forster <florian@caos.ch> * chore(translations): start with upper case on Code * chore(middleware): move funcs * add message to grpc web generation * translation in mgmt and fixes * fix authoptions * fix console statik Co-authored-by: Florian Forster <florian@caos.ch> Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
@@ -2,9 +2,7 @@ package middleware
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/caos/logging"
|
||||
"github.com/caos/zitadel/internal/i18n"
|
||||
"github.com/rakyll/statik/fs"
|
||||
|
||||
"golang.org/x/text/language"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
@@ -14,16 +12,10 @@ import (
|
||||
)
|
||||
|
||||
func ErrorHandler(defaultLanguage language.Tag) func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
|
||||
dir, err := fs.NewWithNamespace("zitadel")
|
||||
logging.Log("ERROR-7usEW").OnError(err).Panic("unable to get zitadel namespace")
|
||||
|
||||
i18n, err := i18n.NewTranslator(dir, i18n.TranslatorConfig{DefaultLanguage: defaultLanguage})
|
||||
if err != nil {
|
||||
logging.Log("ERROR-Sk8sf").OnError(err).Panic("unable to get i18n translator")
|
||||
}
|
||||
translator := newZitadelTranslator(defaultLanguage)
|
||||
|
||||
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
|
||||
resp, err := handler(ctx, req)
|
||||
return resp, grpc_util.CaosToGRPCError(err, ctx, i18n)
|
||||
return resp, grpc_util.CaosToGRPCError(err, ctx, translator)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user