Skip to content

Commit

Permalink
Fix incorrect i18n keys in message strings
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Jan 23, 2021
1 parent ec1c4f3 commit 810607e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cmd/lists.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions cmd/media.go
Original file line number Diff line number Diff line change
Expand Up @@ -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})
}
Expand All @@ -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++ {
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions cmd/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
14 changes: 7 additions & 7 deletions cmd/subscribers.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ 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.
if err := out.Results.LoadLists(app.queries.GetSubscriberListsLazy); err != nil {
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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cmd/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 810607e

Please sign in to comment.