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 <[email protected]>

* Update internal/static/i18n/de.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/de.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/de.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/de.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/de.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/en.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/en.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/en.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/en.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/en.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/de.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/de.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/de.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/de.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/de.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/de.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/de.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/de.yaml

Co-authored-by: Florian Forster <[email protected]>

* Update internal/static/i18n/en.yaml

Co-authored-by: Florian Forster <[email protected]>

* 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 <[email protected]>
Co-authored-by: Livio Amstutz <[email protected]>
This commit is contained in:
Silvan
2020-07-08 09:48:11 +02:00
committed by GitHub
co-authored by Florian Forster Livio Amstutz
parent b863e7c407
commit c0f85c2733
40 changed files with 17383 additions and 18102 deletions
@@ -7,6 +7,8 @@ import (
"github.com/caos/zitadel/internal/eventstore/models"
"github.com/caos/zitadel/internal/model"
proj_model "github.com/caos/zitadel/internal/project/model"
"github.com/caos/zitadel/pkg/message"
"github.com/golang/protobuf/ptypes"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/types/known/structpb"
@@ -335,7 +337,7 @@ func appChangesToMgtAPI(changes *proj_model.ApplicationChanges) (_ []*Change) {
}
result[i] = &Change{
ChangeDate: change.ChangeDate,
EventType: change.EventType,
EventType: message.NewLocalizedEventType(change.EventType),
Sequence: change.Sequence,
Editor: change.ModifierName,
EditorId: change.ModifierId,
+1 -1
View File
@@ -1,4 +1,4 @@
package grpc
//go:generate protoc -I$GOPATH/src -I../proto -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis -I${GOPATH}/src/github.com/envoyproxy/protoc-gen-validate -I${GOPATH}/src/github.com/caos/zitadel/internal/protoc/protoc-gen-authoption --go_out=plugins=grpc:$GOPATH/src --grpc-gateway_out=logtostderr=true,allow_delete_body=true:$GOPATH/src --swagger_out=logtostderr=true,allow_delete_body=true:. --authoption_out=:. ../proto/management.proto
//go:generate protoc -I${GOPATH}/src -I../proto -I${GOPATH}/src/github.com/caos/zitadel/pkg/message -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis -I${GOPATH}/src/github.com/envoyproxy/protoc-gen-validate -I${GOPATH}/src/github.com/caos/zitadel/internal/protoc/protoc-gen-authoption --go_out=plugins=grpc:${GOPATH}/src --grpc-gateway_out=logtostderr=true,allow_delete_body=true:${GOPATH}/src --swagger_out=logtostderr=true,allow_delete_body=true:. --authoption_out=. ../proto/management.proto
//go:generate mockgen -package api -destination ./mock/management.proto.mock.go github.com/caos/zitadel/pkg/management/api/grpc ManagementServiceClient
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+14 -61
View File
@@ -3570,7 +3570,7 @@
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/protobufStruct"
"type": "object"
}
}
},
@@ -3581,19 +3581,6 @@
}
},
"definitions": {
"protobufListValue": {
"type": "object",
"properties": {
"values": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufValue"
},
"description": "Repeated field of dynamically typed values."
}
},
"description": "`ListValue` is a wrapper around a repeated field of values.\n\nThe JSON representation for `ListValue` is JSON array."
},
"protobufNullValue": {
"type": "string",
"enum": [
@@ -3602,51 +3589,6 @@
"default": "NULL_VALUE",
"description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\n The JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value."
},
"protobufStruct": {
"type": "object",
"properties": {
"fields": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/protobufValue"
},
"description": "Unordered map of dynamically typed values."
}
},
"description": "`Struct` represents a structured data value, consisting of fields\nwhich map to dynamically typed values. In some languages, `Struct`\nmight be supported by a native representation. For example, in\nscripting languages like JS a struct is represented as an\nobject. The details of that representation are described together\nwith the proto support for the language.\n\nThe JSON representation for `Struct` is JSON object."
},
"protobufValue": {
"type": "object",
"properties": {
"null_value": {
"$ref": "#/definitions/protobufNullValue",
"description": "Represents a null value."
},
"number_value": {
"type": "number",
"format": "double",
"description": "Represents a double value."
},
"string_value": {
"type": "string",
"description": "Represents a string value."
},
"bool_value": {
"type": "boolean",
"format": "boolean",
"description": "Represents a boolean value."
},
"struct_value": {
"$ref": "#/definitions/protobufStruct",
"description": "Represents a structured value."
},
"list_value": {
"$ref": "#/definitions/protobufListValue",
"description": "Represents a repeated `Value`."
}
},
"description": "`Value` represents a dynamically typed value which can be either\nnull, a number, a string, a boolean, a recursive struct value, or a\nlist of values. A producer of value is expected to set one of that\nvariants, absence of any variant indicates an error.\n\nThe JSON representation for `Value` is JSON value."
},
"v1AddOrgDomainRequest": {
"type": "object",
"properties": {
@@ -3836,7 +3778,7 @@
"format": "date-time"
},
"event_type": {
"type": "string"
"$ref": "#/definitions/v1LocalizedMessage"
},
"sequence": {
"type": "string",
@@ -3849,7 +3791,7 @@
"type": "string"
},
"data": {
"$ref": "#/definitions/protobufStruct"
"type": "object"
}
}
},
@@ -3997,6 +3939,17 @@
}
}
},
"v1LocalizedMessage": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"localized_message": {
"type": "string"
}
}
},
"v1MFAState": {
"type": "string",
"enum": [
+3 -1
View File
@@ -5,6 +5,8 @@ import (
"github.com/caos/logging"
org_model "github.com/caos/zitadel/internal/org/model"
"github.com/caos/zitadel/pkg/message"
"github.com/golang/protobuf/ptypes"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/types/known/structpb"
@@ -171,7 +173,7 @@ func orgChangesToMgtAPI(changes *org_model.OrgChanges) (_ []*Change) {
}
result[i] = &Change{
ChangeDate: change.ChangeDate,
EventType: change.EventType,
EventType: message.NewLocalizedEventType(change.EventType),
Sequence: change.Sequence,
Data: data,
Editor: change.ModifierName,
+3 -1
View File
@@ -6,6 +6,8 @@ import (
"github.com/caos/logging"
"github.com/caos/zitadel/internal/eventstore/models"
proj_model "github.com/caos/zitadel/internal/project/model"
"github.com/caos/zitadel/pkg/message"
"github.com/golang/protobuf/ptypes"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/types/known/structpb"
@@ -287,7 +289,7 @@ func projectChangesToMgtAPI(changes *proj_model.ProjectChanges) (_ []*Change) {
}
result[i] = &Change{
ChangeDate: change.ChangeDate,
EventType: change.EventType,
EventType: message.NewLocalizedEventType(change.EventType),
Sequence: change.Sequence,
Editor: change.ModifierName,
EditorId: change.ModifierId,
+1
View File
@@ -52,6 +52,7 @@ func (s *Server) GRPCServer(defaults systemdefaults.SystemDefaults) (*grpc.Serve
grpc.UnaryInterceptor(
grpc_middleware.ChainUnaryServer(
middleware.ErrorHandler(defaults.DefaultLanguage),
middleware.TranslationHandler(defaults.DefaultLanguage),
ManagementService_Authorization_Interceptor(s.verifier, &s.authZ),
),
),
+3 -1
View File
@@ -6,6 +6,8 @@ import (
"github.com/caos/logging"
"github.com/caos/zitadel/internal/eventstore/models"
usr_model "github.com/caos/zitadel/internal/user/model"
"github.com/caos/zitadel/pkg/message"
"github.com/golang/protobuf/ptypes"
"golang.org/x/text/language"
"google.golang.org/protobuf/encoding/protojson"
@@ -504,7 +506,7 @@ func userChangesToMgtAPI(changes *usr_model.UserChanges) (_ []*Change) {
result[i] = &Change{
ChangeDate: change.ChangeDate,
EventType: change.EventType,
EventType: message.NewLocalizedEventType(change.EventType),
Sequence: change.Sequence,
Data: data,
EditorId: change.ModifierId,