Fix incorrect i18n keys in message strings

This commit is contained in:
Kailash Nadh 2021-01-23 18:48:10 +05:30
parent ec1c4f30ed
commit 810607e547
5 changed files with 15 additions and 15 deletions

View File

@ -54,7 +54,7 @@ func handleGetLists(c echo.Context) error {
app.log.Printf("error fetching lists: %v", err) app.log.Printf("error fetching lists: %v", err)
return echo.NewHTTPError(http.StatusInternalServerError, return echo.NewHTTPError(http.StatusInternalServerError,
app.i18n.Ts2("globals.messages.errorFetching", 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 { if single && len(out.Results) == 0 {
return echo.NewHTTPError(http.StatusBadRequest, return echo.NewHTTPError(http.StatusBadRequest,

View File

@ -104,7 +104,7 @@ func handleUploadMedia(c echo.Context) error {
app.log.Printf("error inserting uploaded file to db: %v", err) app.log.Printf("error inserting uploaded file to db: %v", err)
return echo.NewHTTPError(http.StatusInternalServerError, return echo.NewHTTPError(http.StatusInternalServerError,
app.i18n.Ts2("globals.messages.errorCreating", 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}) 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 { if err := app.queries.GetMedia.Select(&out, app.constants.MediaProvider); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, return echo.NewHTTPError(http.StatusInternalServerError,
app.i18n.Ts2("globals.messages.errorFetching", 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++ { 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 { if err := app.queries.DeleteMedia.Get(&m, id); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, return echo.NewHTTPError(http.StatusInternalServerError,
app.i18n.Ts2("globals.messages.errorDeleting", 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) app.media.Delete(m.Filename)

View File

@ -195,7 +195,7 @@ func handleUpdateSettings(c echo.Context) error {
if _, err := app.queries.UpdateSettings.Exec(b); err != nil { if _, err := app.queries.UpdateSettings.Exec(b); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, return echo.NewHTTPError(http.StatusInternalServerError,
app.i18n.Ts2("globals.messages.errorUpdating", 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 // 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 { if err := app.queries.GetSettings.Get(&b); err != nil {
return out, echo.NewHTTPError(http.StatusInternalServerError, return out, echo.NewHTTPError(http.StatusInternalServerError,
app.i18n.Ts2("globals.messages.errorFetching", 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. // Unmarshall the settings and filter out sensitive fields.

View File

@ -136,7 +136,7 @@ func handleQuerySubscribers(c echo.Context) error {
if err := tx.Select(&out.Results, stmt, listIDs, pg.Offset, pg.Limit); err != nil { if err := tx.Select(&out.Results, stmt, listIDs, pg.Offset, pg.Limit); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, return echo.NewHTTPError(http.StatusInternalServerError,
app.i18n.Ts2("globals.messages.errorFetching", 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. // 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) app.log.Printf("error fetching subscriber lists: %v", err)
return echo.NewHTTPError(http.StatusInternalServerError, return echo.NewHTTPError(http.StatusInternalServerError,
app.i18n.Ts2("globals.messages.errorFetching", app.i18n.Ts2("globals.messages.errorFetching",
"name", "globals.terms.subscribers", "error", pqErrMsg(err))) "name", "{globals.terms.subscribers}", "error", pqErrMsg(err)))
} }
out.Query = query out.Query = query
@ -232,7 +232,7 @@ loop:
if err := tx.Select(&out, listIDs, id, app.constants.DBBatchSize); err != nil { if err := tx.Select(&out, listIDs, id, app.constants.DBBatchSize); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, return echo.NewHTTPError(http.StatusInternalServerError,
app.i18n.Ts2("globals.messages.errorFetching", app.i18n.Ts2("globals.messages.errorFetching",
"name", "globals.terms.subscribers", "error", pqErrMsg(err))) "name", "{globals.terms.subscribers}", "error", pqErrMsg(err)))
} }
if len(out) == 0 { if len(out) == 0 {
break loop break loop
@ -341,7 +341,7 @@ func handleSubscriberSendOptin(c echo.Context) error {
app.log.Printf("error fetching subscriber: %v", err) app.log.Printf("error fetching subscriber: %v", err)
return echo.NewHTTPError(http.StatusInternalServerError, return echo.NewHTTPError(http.StatusInternalServerError,
app.i18n.Ts2("globals.messages.errorFetching", app.i18n.Ts2("globals.messages.errorFetching",
"name", "globals.terms.subscribers", "error", pqErrMsg(err))) "name", "{globals.terms.subscribers}", "error", pqErrMsg(err)))
} }
if len(out) == 0 { if len(out) == 0 {
return echo.NewHTTPError(http.StatusBadRequest, return echo.NewHTTPError(http.StatusBadRequest,
@ -604,7 +604,7 @@ func handleExportSubscriberData(c echo.Context) error {
app.log.Printf("error exporting subscriber data: %s", err) app.log.Printf("error exporting subscriber data: %s", err)
return echo.NewHTTPError(http.StatusInternalServerError, return echo.NewHTTPError(http.StatusInternalServerError,
app.i18n.Ts2("globals.messages.errorFetching", 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") 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) app.log.Printf("error fetching subscriber: %v", err)
return models.Subscriber{}, echo.NewHTTPError(http.StatusInternalServerError, return models.Subscriber{}, echo.NewHTTPError(http.StatusInternalServerError,
app.i18n.Ts2("globals.messages.errorFetching", app.i18n.Ts2("globals.messages.errorFetching",
"name", "globals.terms.subscriber", "error", pqErrMsg(err))) "name", "{globals.terms.subscriber}", "error", pqErrMsg(err)))
} }
if len(out) == 0 { if len(out) == 0 {
return models.Subscriber{}, echo.NewHTTPError(http.StatusBadRequest, 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) app.log.Printf("error loading subscriber lists: %v", err)
return models.Subscriber{}, echo.NewHTTPError(http.StatusInternalServerError, return models.Subscriber{}, echo.NewHTTPError(http.StatusInternalServerError,
app.i18n.Ts2("globals.messages.errorFetching", app.i18n.Ts2("globals.messages.errorFetching",
"name", "globals.terms.lists", "error", pqErrMsg(err))) "name", "{globals.terms.lists}", "error", pqErrMsg(err)))
} }
return out[0], nil return out[0], nil

View File

@ -51,7 +51,7 @@ func handleGetTemplates(c echo.Context) error {
if err != nil { if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, return echo.NewHTTPError(http.StatusInternalServerError,
app.i18n.Ts2("globals.messages.errorFetching", 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 { if single && len(out) == 0 {
return echo.NewHTTPError(http.StatusBadRequest, return echo.NewHTTPError(http.StatusBadRequest,
@ -91,7 +91,7 @@ func handlePreviewTemplate(c echo.Context) error {
if err != nil { if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, return echo.NewHTTPError(http.StatusInternalServerError,
app.i18n.Ts2("globals.messages.errorFetching", app.i18n.Ts2("globals.messages.errorFetching",
"name", "globals.terms.templates", "error", pqErrMsg(err))) "name", "{globals.terms.templates}", "error", pqErrMsg(err)))
} }
if len(tpls) == 0 { if len(tpls) == 0 {