From 344836dfb22fb36d4d2740c5ec226de78d9dcd3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Tue, 19 Jun 2018 19:40:26 +0200 Subject: Add missed translations (#8959) --- api4/system_test.go | 4 +- api4/user.go | 4 +- i18n/en.json | 80 +++++++++++++++++++++++++++++++ model/cluster_discovery.go | 10 ++-- model/config.go | 2 +- model/incoming_webhook.go | 2 +- store/sqlstore/cluster_discovery_store.go | 12 ++--- utils/file_backend.go | 2 +- utils/file_backend_local.go | 2 +- utils/file_backend_s3.go | 6 +-- 10 files changed, 101 insertions(+), 23 deletions(-) diff --git a/api4/system_test.go b/api4/system_test.go index f784a8be4..099c193d0 100644 --- a/api4/system_test.go +++ b/api4/system_test.go @@ -696,9 +696,7 @@ func TestS3TestConnection(t *testing.T) { config.FileSettings.AmazonS3Bucket = "Wrong_bucket" _, resp = th.SystemAdminClient.TestS3Connection(&config) CheckInternalErrorStatus(t, resp) - if resp.Error.Message != "Unable to create bucket" { - t.Fatal("should return error ") - } + assert.Equal(t, "Unable to create bucket.", resp.Error.Message) config.FileSettings.AmazonS3Bucket = "shouldcreatenewbucket" _, resp = th.SystemAdminClient.TestS3Connection(&config) diff --git a/api4/user.go b/api4/user.go index 2b79b19f1..14ab3a0a2 100644 --- a/api4/user.go +++ b/api4/user.go @@ -985,14 +985,14 @@ func login(c *Context, w http.ResponseWriter, r *http.Request) { if *c.App.Config().ExperimentalSettings.ClientSideCertEnable { if license := c.App.License(); license == nil || !*license.Features.SAML { - c.Err = model.NewAppError("ClientSideCertNotAllowed", "Attempt to use the experimental feature ClientSideCertEnable without a valid enterprise license", nil, "", http.StatusBadRequest) + c.Err = model.NewAppError("ClientSideCertNotAllowed", "api.user.login.client_side_cert.license.app_error", nil, "", http.StatusBadRequest) return } else { certPem, certSubject, certEmail := c.App.CheckForClienSideCert(r) mlog.Debug("Client Cert", mlog.String("cert_subject", certSubject), mlog.String("cert_email", certEmail)) if len(certPem) == 0 || len(certEmail) == 0 { - c.Err = model.NewAppError("ClientSideCertMissing", "Attempted to sign in using the experimental feature ClientSideCert without providing a valid certificate", nil, "", http.StatusBadRequest) + c.Err = model.NewAppError("ClientSideCertMissing", "api.user.login.client_side_cert.certificate.app_error", nil, "", http.StatusBadRequest) return } else if *c.App.Config().ExperimentalSettings.ClientSideCertCheck == model.CLIENT_SIDE_CERT_CHECK_PRIMARY_AUTH { loginId = certEmail diff --git a/i18n/en.json b/i18n/en.json index 4b1849ccc..9964670bf 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -1476,6 +1476,10 @@ "id": "api.file.move_file.rename.app_error", "translation": "Unable to move file locally." }, + { + "id": "api.file.no_driver.app_error", + "translation": "No file driver selected." + }, { "id": "api.file.read_file.configured.app_error", "translation": "File storage not configured properly. Please configure for either S3 or local server file storage." @@ -1488,6 +1492,22 @@ "id": "api.file.read_file.reading_local.app_error", "translation": "Encountered an error reading from local server storage" }, + { + "id": "api.file.test_connection.local.connection.app_error", + "translation": "Don't have permissions to write to local path specified or other error." + }, + { + "id": "api.file.test_connection.s3.connection.app_error", + "translation": "Bad connection to S3 or minio." + }, + { + "id": "api.file.test_connection.s3.bucket_exists.app_error", + "translation": "Error checking if bucket exists." + }, + { + "id": "api.file.test_connection.s3.bucked_create.app_error", + "translation": "Unable to create bucket." + }, { "id": "api.file.upload_file.bad_parse.app_error", "translation": "Unable to upload file. Header cannot be parsed." @@ -2954,6 +2974,14 @@ "id": "api.user.login.blank_pwd.app_error", "translation": "Password field must not be blank" }, + { + "id": "api.user.login.client_side_cert.license.app_error", + "translation": "Attempt to use the experimental feature ClientSideCertEnable without a valid enterprise license" + }, + { + "id": "api.user.login.client_side_cert.certificate.app_error", + "translation": "Attempted to sign in using the experimental feature ClientSideCert without providing a valid certificate" + }, { "id": "api.user.login.inactive.app_error", "translation": "Login failed because your account has been deactivated. Please contact an administrator." @@ -4850,10 +4878,30 @@ "id": "model.client.writer.app_error", "translation": "Unable to build multipart request" }, + { + "id": "model.cluster.is_valid.create_at.app_error", + "translation": "CreateAt must be set" + }, + { + "id": "model.cluster.is_valid.hostname.app_error", + "translation": "Hostname must be set" + }, { "id": "model.cluster.is_valid.id.app_error", "translation": "Invalid Id" }, + { + "id": "model.cluster.is_valid.last_ping_at.app_error", + "translation": "LastPingAt must be set" + }, + { + "id": "model.cluster.is_valid.name.app_error", + "translation": "ClusterName must be set" + }, + { + "id": "model.cluster.is_valid.type.app_error", + "translation": "Type must be set" + }, { "id": "model.command.is_valid.create_at.app_error", "translation": "Create at must be a valid time" @@ -4954,6 +5002,10 @@ "id": "model.compliance.is_valid.start_end_at.app_error", "translation": "To must be greater than From" }, + { + "id": "model.config.is_valid.allow_cookies_for_subdomains.app_error", + "translation": "Allowing cookies for subdomains requires SiteURL to be set." + }, { "id": "model.config.is_valid.atmos_camo_image_proxy_options.app_error", "translation": "Invalid atmos/camo image proxy options for service settings. Must be set to your shared key." @@ -5414,6 +5466,10 @@ "id": "model.incoming_hook.id.app_error", "translation": "Invalid Id" }, + { + "id": "model.incoming_hook.parse_data.app_error", + "translation": "Unable to parse incoming data" + }, { "id": "model.incoming_hook.team_id.app_error", "translation": "Invalid team ID" @@ -6286,6 +6342,30 @@ "id": "store.sql_channel_member_history.permanent_delete_batch.app_error", "translation": "Failed to purge records" }, + { + "id": "store.sql_cluster_discovery.save.app_error", + "translation": "Failed to save ClusterDiscovery row" + }, + { + "id": "store.sql_cluster_discovery.delete.app_error", + "translation": "Failed to delete" + }, + { + "id": "store.sql_cluster_discovery.exists.app_error", + "translation": "Failed to check if it exists" + }, + { + "id": "store.sql_cluster_discovery.get_all.app_error", + "translation": "Failed to get all disoery rows" + }, + { + "id": "store.sql_cluster_discovery.set_last_ping.app_error", + "translation": "Failed to update last ping at" + }, + { + "id": "store.sql_cluster_discovery.cleanup.app_error", + "translation": "Failed to save ClusterDiscovery row" + }, { "id": "store.sql_command.analytics_command_count.app_error", "translation": "We couldn't count the commands" diff --git a/model/cluster_discovery.go b/model/cluster_discovery.go index 5d5b0465d..796d3dda0 100644 --- a/model/cluster_discovery.go +++ b/model/cluster_discovery.go @@ -90,23 +90,23 @@ func (o *ClusterDiscovery) IsValid() *AppError { } if len(o.ClusterName) == 0 { - return NewAppError("ClusterDiscovery.IsValid", "ClusterName must be set", nil, "", http.StatusBadRequest) + return NewAppError("ClusterDiscovery.IsValid", "model.cluster.is_valid.name.app_error", nil, "", http.StatusBadRequest) } if len(o.Type) == 0 { - return NewAppError("ClusterDiscovery.IsValid", "Type must be set", nil, "", http.StatusBadRequest) + return NewAppError("ClusterDiscovery.IsValid", "model.cluster.is_valid.type.app_error", nil, "", http.StatusBadRequest) } if len(o.Hostname) == 0 { - return NewAppError("ClusterDiscovery.IsValid", "Hostname must be set", nil, "", http.StatusBadRequest) + return NewAppError("ClusterDiscovery.IsValid", "model.cluster.is_valid.hostname.app_error", nil, "", http.StatusBadRequest) } if o.CreateAt == 0 { - return NewAppError("ClusterDiscovery.IsValid", "CreateAt must be set", nil, "", http.StatusBadRequest) + return NewAppError("ClusterDiscovery.IsValid", "model.cluster.is_valid.create_at.app_error", nil, "", http.StatusBadRequest) } if o.LastPingAt == 0 { - return NewAppError("ClusterDiscovery.IsValid", "LastPingAt must be set", nil, "", http.StatusBadRequest) + return NewAppError("ClusterDiscovery.IsValid", "model.cluster.is_valid.last_ping_at.app_error", nil, "", http.StatusBadRequest) } return nil diff --git a/model/config.go b/model/config.go index 2f40c22b0..0931cff87 100644 --- a/model/config.go +++ b/model/config.go @@ -1946,7 +1946,7 @@ func (o *Config) IsValid() *AppError { } if len(*o.ServiceSettings.SiteURL) == 0 && *o.ServiceSettings.AllowCookiesForSubdomains { - return NewAppError("Config.IsValid", "Allowing cookies for subdomains requires SiteURL to be set.", nil, "", http.StatusBadRequest) + return NewAppError("Config.IsValid", "model.config.is_valid.allow_cookies_for_subdomains.app_error", nil, "", http.StatusBadRequest) } if err := o.TeamSettings.isValid(); err != nil { diff --git a/model/incoming_webhook.go b/model/incoming_webhook.go index 202073b5b..1d6d7b4f0 100644 --- a/model/incoming_webhook.go +++ b/model/incoming_webhook.go @@ -197,7 +197,7 @@ func IncomingWebhookRequestFromJson(data io.Reader) (*IncomingWebhookRequest, *A if err != nil { o, err = decodeIncomingWebhookRequest(escapeControlCharsFromPayload(by)) if err != nil { - return nil, NewAppError("IncomingWebhookRequestFromJson", "Unable to parse incoming data", nil, err.Error(), http.StatusBadRequest) + return nil, NewAppError("IncomingWebhookRequestFromJson", "model.incoming_hook.parse_data.app_error", nil, err.Error(), http.StatusBadRequest) } } diff --git a/store/sqlstore/cluster_discovery_store.go b/store/sqlstore/cluster_discovery_store.go index 94639f74c..14810cadb 100644 --- a/store/sqlstore/cluster_discovery_store.go +++ b/store/sqlstore/cluster_discovery_store.go @@ -36,7 +36,7 @@ func (s sqlClusterDiscoveryStore) Save(ClusterDiscovery *model.ClusterDiscovery) } if err := s.GetMaster().Insert(ClusterDiscovery); err != nil { - result.Err = model.NewAppError("SqlClusterDiscoveryStore.Save", "Failed to save ClusterDiscovery row", nil, err.Error(), http.StatusInternalServerError) + result.Err = model.NewAppError("SqlClusterDiscoveryStore.Save", "store.sql_cluster_discovery.save.app_error", nil, err.Error(), http.StatusInternalServerError) } }) } @@ -61,7 +61,7 @@ func (s sqlClusterDiscoveryStore) Delete(ClusterDiscovery *model.ClusterDiscover "Hostname": ClusterDiscovery.Hostname, }, ); err != nil { - result.Err = model.NewAppError("SqlClusterDiscoveryStore.Delete", "Failed to delete", nil, err.Error(), http.StatusInternalServerError) + result.Err = model.NewAppError("SqlClusterDiscoveryStore.Delete", "store.sql_cluster_discovery.delete.app_error", nil, err.Error(), http.StatusInternalServerError) } else { if count > 0 { result.Data = true @@ -91,7 +91,7 @@ func (s sqlClusterDiscoveryStore) Exists(ClusterDiscovery *model.ClusterDiscover "Hostname": ClusterDiscovery.Hostname, }, ); err != nil { - result.Err = model.NewAppError("SqlClusterDiscoveryStore.Exists", "Failed to check if it exists", nil, err.Error(), http.StatusInternalServerError) + result.Err = model.NewAppError("SqlClusterDiscoveryStore.Exists", "store.sql_cluster_discovery.exists.app_error", nil, err.Error(), http.StatusInternalServerError) } else { if count > 0 { result.Data = true @@ -123,7 +123,7 @@ func (s sqlClusterDiscoveryStore) GetAll(ClusterDiscoveryType, clusterName strin "LastPingAt": lastPingAt, }, ); err != nil { - result.Err = model.NewAppError("SqlClusterDiscoveryStore.GetAllForType", "Failed to get all disoery rows", nil, err.Error(), http.StatusInternalServerError) + result.Err = model.NewAppError("SqlClusterDiscoveryStore.GetAllForType", "store.sql_cluster_discovery.get_all.app_error", nil, err.Error(), http.StatusInternalServerError) } else { result.Data = list } @@ -149,7 +149,7 @@ func (s sqlClusterDiscoveryStore) SetLastPingAt(ClusterDiscovery *model.ClusterD "Hostname": ClusterDiscovery.Hostname, }, ); err != nil { - result.Err = model.NewAppError("SqlClusterDiscoveryStore.GetAllForType", "Failed to update last ping at", nil, err.Error(), http.StatusInternalServerError) + result.Err = model.NewAppError("SqlClusterDiscoveryStore.GetAllForType", "store.sql_cluster_discovery.set_last_ping.app_error", nil, err.Error(), http.StatusInternalServerError) } }) } @@ -166,7 +166,7 @@ func (s sqlClusterDiscoveryStore) Cleanup() store.StoreChannel { "LastPingAt": model.GetMillis() - model.CDS_OFFLINE_AFTER_MILLIS, }, ); err != nil { - result.Err = model.NewAppError("SqlClusterDiscoveryStore.Save", "Failed to save ClusterDiscovery row", nil, err.Error(), http.StatusInternalServerError) + result.Err = model.NewAppError("SqlClusterDiscoveryStore.Save", "store.sql_cluster_discovery.cleanup.app_error", nil, err.Error(), http.StatusInternalServerError) } }) } diff --git a/utils/file_backend.go b/utils/file_backend.go index 0da0bc3b8..60c90960d 100644 --- a/utils/file_backend.go +++ b/utils/file_backend.go @@ -42,5 +42,5 @@ func NewFileBackend(settings *model.FileSettings, enableComplianceFeatures bool) directory: settings.Directory, }, nil } - return nil, model.NewAppError("NewFileBackend", "No file driver selected.", nil, "", http.StatusInternalServerError) + return nil, model.NewAppError("NewFileBackend", "api.file.no_driver.app_error", nil, "", http.StatusInternalServerError) } diff --git a/utils/file_backend_local.go b/utils/file_backend_local.go index 37bca7987..a2d311f83 100644 --- a/utils/file_backend_local.go +++ b/utils/file_backend_local.go @@ -26,7 +26,7 @@ type LocalFileBackend struct { func (b *LocalFileBackend) TestConnection() *model.AppError { f := bytes.NewReader([]byte("testingwrite")) if _, err := writeFileLocally(f, filepath.Join(b.directory, TEST_FILE_PATH)); err != nil { - return model.NewAppError("TestFileConnection", "Don't have permissions to write to local path specified or other error.", nil, err.Error(), http.StatusInternalServerError) + return model.NewAppError("TestFileConnection", "api.file.test_connection.local.connection.app_error", nil, err.Error(), http.StatusInternalServerError) } os.Remove(filepath.Join(b.directory, TEST_FILE_PATH)) mlog.Info("Able to write files to local storage.") diff --git a/utils/file_backend_s3.go b/utils/file_backend_s3.go index 1772f09ea..6f1fa9ab0 100644 --- a/utils/file_backend_s3.go +++ b/utils/file_backend_s3.go @@ -62,12 +62,12 @@ func (b *S3FileBackend) s3New() (*s3.Client, error) { func (b *S3FileBackend) TestConnection() *model.AppError { s3Clnt, err := b.s3New() if err != nil { - return model.NewAppError("TestFileConnection", "Bad connection to S3 or minio.", nil, err.Error(), http.StatusInternalServerError) + return model.NewAppError("TestFileConnection", "api.file.test_connection.s3.connection.app_error", nil, err.Error(), http.StatusInternalServerError) } exists, err := s3Clnt.BucketExists(b.bucket) if err != nil { - return model.NewAppError("TestFileConnection", "Error checking if bucket exists.", nil, err.Error(), http.StatusInternalServerError) + return model.NewAppError("TestFileConnection", "api.file.test_connection.s3.bucket_exists.app_error", nil, err.Error(), http.StatusInternalServerError) } if !exists { @@ -75,7 +75,7 @@ func (b *S3FileBackend) TestConnection() *model.AppError { err := s3Clnt.MakeBucket(b.bucket, b.region) if err != nil { mlog.Error("Unable to create bucket.") - return model.NewAppError("TestFileConnection", "Unable to create bucket", nil, err.Error(), http.StatusInternalServerError) + return model.NewAppError("TestFileConnection", "api.file.test_connection.s3.bucked_create.app_error", nil, err.Error(), http.StatusInternalServerError) } } mlog.Info("Connection to S3 or minio is good. Bucket exists.") -- cgit v1.2.3-1-g7c22