From 810607e547e27be778263ee8e994fe899a2a6002 Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Sat, 23 Jan 2021 18:48:10 +0530 Subject: [PATCH] Fix incorrect i18n keys in message strings --- cmd/lists.go | 2 +- cmd/media.go | 6 +++--- cmd/settings.go | 4 ++-- cmd/subscribers.go | 14 +++++++------- cmd/templates.go | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cmd/lists.go b/cmd/lists.go index 53cac81..1a60fa6 100644 --- a/cmd/lists.go +++ b/cmd/lists.go @@ -54,7 +54,7 @@ func handleGetLists(c echo.Context) error { app.log.Printf("error fetching lists: %v", err) return echo.NewHTTPError(http.StatusInternalServerError, app.i18n.Ts2("globals.messages.errorFetching", - "name", "globals.terms.lists", "error", pqErrMsg(err))) + "name", "{globals.terms.lists}", "error", pqErrMsg(err))) } if single && len(out.Results) == 0 { return echo.NewHTTPError(http.StatusBadRequest, diff --git a/cmd/media.go b/cmd/media.go index db10e6b..53c6605 100644 --- a/cmd/media.go +++ b/cmd/media.go @@ -104,7 +104,7 @@ func handleUploadMedia(c echo.Context) error { app.log.Printf("error inserting uploaded file to db: %v", err) return echo.NewHTTPError(http.StatusInternalServerError, app.i18n.Ts2("globals.messages.errorCreating", - "name", "globals.terms.media", "error", pqErrMsg(err))) + "name", "{globals.terms.media}", "error", pqErrMsg(err))) } return c.JSON(http.StatusOK, okResp{true}) } @@ -119,7 +119,7 @@ func handleGetMedia(c echo.Context) error { if err := app.queries.GetMedia.Select(&out, app.constants.MediaProvider); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, app.i18n.Ts2("globals.messages.errorFetching", - "name", "globals.terms.media", "error", pqErrMsg(err))) + "name", "{globals.terms.media}", "error", pqErrMsg(err))) } for i := 0; i < len(out); i++ { @@ -145,7 +145,7 @@ func handleDeleteMedia(c echo.Context) error { if err := app.queries.DeleteMedia.Get(&m, id); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, app.i18n.Ts2("globals.messages.errorDeleting", - "name", "globals.terms.media", "error", pqErrMsg(err))) + "name", "{globals.terms.media}", "error", pqErrMsg(err))) } app.media.Delete(m.Filename) diff --git a/cmd/settings.go b/cmd/settings.go index 3ec84a7..60fb242 100644 --- a/cmd/settings.go +++ b/cmd/settings.go @@ -195,7 +195,7 @@ func handleUpdateSettings(c echo.Context) error { if _, err := app.queries.UpdateSettings.Exec(b); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, app.i18n.Ts2("globals.messages.errorUpdating", - "name", "globals.terms.settings", "error", pqErrMsg(err))) + "name", "{globals.terms.settings}", "error", pqErrMsg(err))) } // If there are any active campaigns, don't do an auto reload and @@ -234,7 +234,7 @@ func getSettings(app *App) (settings, error) { if err := app.queries.GetSettings.Get(&b); err != nil { return out, echo.NewHTTPError(http.StatusInternalServerError, app.i18n.Ts2("globals.messages.errorFetching", - "name", "globals.terms.settings", "error", pqErrMsg(err))) + "name", "{globals.terms.settings}", "error", pqErrMsg(err))) } // Unmarshall the settings and filter out sensitive fields. diff --git a/cmd/subscribers.go b/cmd/subscribers.go index 7f91462..ca277ba 100644 --- a/cmd/subscribers.go +++ b/cmd/subscribers.go @@ -136,7 +136,7 @@ func handleQuerySubscribers(c echo.Context) error { if err := tx.Select(&out.Results, stmt, listIDs, pg.Offset, pg.Limit); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, app.i18n.Ts2("globals.messages.errorFetching", - "name", "globals.terms.subscribers", "error", pqErrMsg(err))) + "name", "{globals.terms.subscribers}", "error", pqErrMsg(err))) } // Lazy load lists for each subscriber. @@ -144,7 +144,7 @@ func handleQuerySubscribers(c echo.Context) error { app.log.Printf("error fetching subscriber lists: %v", err) return echo.NewHTTPError(http.StatusInternalServerError, app.i18n.Ts2("globals.messages.errorFetching", - "name", "globals.terms.subscribers", "error", pqErrMsg(err))) + "name", "{globals.terms.subscribers}", "error", pqErrMsg(err))) } out.Query = query @@ -232,7 +232,7 @@ loop: if err := tx.Select(&out, listIDs, id, app.constants.DBBatchSize); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, app.i18n.Ts2("globals.messages.errorFetching", - "name", "globals.terms.subscribers", "error", pqErrMsg(err))) + "name", "{globals.terms.subscribers}", "error", pqErrMsg(err))) } if len(out) == 0 { break loop @@ -341,7 +341,7 @@ func handleSubscriberSendOptin(c echo.Context) error { app.log.Printf("error fetching subscriber: %v", err) return echo.NewHTTPError(http.StatusInternalServerError, app.i18n.Ts2("globals.messages.errorFetching", - "name", "globals.terms.subscribers", "error", pqErrMsg(err))) + "name", "{globals.terms.subscribers}", "error", pqErrMsg(err))) } if len(out) == 0 { return echo.NewHTTPError(http.StatusBadRequest, @@ -604,7 +604,7 @@ func handleExportSubscriberData(c echo.Context) error { app.log.Printf("error exporting subscriber data: %s", err) return echo.NewHTTPError(http.StatusInternalServerError, app.i18n.Ts2("globals.messages.errorFetching", - "name", "globals.terms.subscribers", "error", err.Error())) + "name", "{globals.terms.subscribers}", "error", err.Error())) } c.Response().Header().Set("Cache-Control", "no-cache") @@ -666,7 +666,7 @@ func getSubscriber(id int, app *App) (models.Subscriber, error) { app.log.Printf("error fetching subscriber: %v", err) return models.Subscriber{}, echo.NewHTTPError(http.StatusInternalServerError, app.i18n.Ts2("globals.messages.errorFetching", - "name", "globals.terms.subscriber", "error", pqErrMsg(err))) + "name", "{globals.terms.subscriber}", "error", pqErrMsg(err))) } if len(out) == 0 { return models.Subscriber{}, echo.NewHTTPError(http.StatusBadRequest, @@ -676,7 +676,7 @@ func getSubscriber(id int, app *App) (models.Subscriber, error) { app.log.Printf("error loading subscriber lists: %v", err) return models.Subscriber{}, echo.NewHTTPError(http.StatusInternalServerError, app.i18n.Ts2("globals.messages.errorFetching", - "name", "globals.terms.lists", "error", pqErrMsg(err))) + "name", "{globals.terms.lists}", "error", pqErrMsg(err))) } return out[0], nil diff --git a/cmd/templates.go b/cmd/templates.go index 4568c38..12dba31 100644 --- a/cmd/templates.go +++ b/cmd/templates.go @@ -51,7 +51,7 @@ func handleGetTemplates(c echo.Context) error { if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, app.i18n.Ts2("globals.messages.errorFetching", - "name", "globals.terms.templates", "error", pqErrMsg(err))) + "name", "{globals.terms.templates}", "error", pqErrMsg(err))) } if single && len(out) == 0 { return echo.NewHTTPError(http.StatusBadRequest, @@ -91,7 +91,7 @@ func handlePreviewTemplate(c echo.Context) error { if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, app.i18n.Ts2("globals.messages.errorFetching", - "name", "globals.terms.templates", "error", pqErrMsg(err))) + "name", "{globals.terms.templates}", "error", pqErrMsg(err))) } if len(tpls) == 0 {