From b1e8f534eff7569dc2e8dab4dee851d1b709f71b Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sat, 22 Sep 2018 15:04:55 -0700 Subject: Simplify locale package usage (refactoring) --- ui/oauth2_unlink.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ui/oauth2_unlink.go') diff --git a/ui/oauth2_unlink.go b/ui/oauth2_unlink.go index 191d78d..4435733 100644 --- a/ui/oauth2_unlink.go +++ b/ui/oauth2_unlink.go @@ -11,12 +11,14 @@ import ( "miniflux.app/http/response" "miniflux.app/http/response/html" "miniflux.app/http/route" + "miniflux.app/locale" "miniflux.app/logger" "miniflux.app/ui/session" ) // OAuth2Unlink unlink an account from the external provider. func (c *Controller) OAuth2Unlink(w http.ResponseWriter, r *http.Request) { + printer := locale.NewPrinter(request.UserLanguage(r)) provider := request.Param(r, "provider", "") if provider == "" { logger.Info("[OAuth2] Invalid or missing provider") @@ -40,7 +42,7 @@ func (c *Controller) OAuth2Unlink(w http.ResponseWriter, r *http.Request) { } if !hasPassword { - sess.NewFlashErrorMessage(c.translator.GetLanguage(request.UserLanguage(r)).Get("error.unlink_account_without_password")) + sess.NewFlashErrorMessage(printer.Printf("error.unlink_account_without_password")) response.Redirect(w, r, route.Path(c.router, "settings")) return } @@ -50,6 +52,6 @@ func (c *Controller) OAuth2Unlink(w http.ResponseWriter, r *http.Request) { return } - sess.NewFlashMessage(c.translator.GetLanguage(request.UserLanguage(r)).Get("alert.account_unlinked")) + sess.NewFlashMessage(printer.Printf("alert.account_unlinked")) response.Redirect(w, r, route.Path(c.router, "settings")) } -- cgit v1.2.3