summaryrefslogtreecommitdiffci
path: root/internal/router/handlers/api-v1-subs-put.go
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
authorGravatar SayaAndy <saya.andy@posteo.com> 2026-05-17 17:13:32 +0700
committerGravatar SayaAndy <saya.andy@posteo.com> 2026-05-17 17:13:32 +0700
commite9353a66bf51486f702eaa0f591dea54c9bd4cd1 (patch)
treedd8d121366259045799475f4e402f2908af1d997 /internal/router/handlers/api-v1-subs-put.go
parent1c441f5eab9a2a24fe5309178ce010f32adac1c7 (diff)
downloadweb-e9353a66bf51486f702eaa0f591dea54c9bd4cd1.tar.gz
web-e9353a66bf51486f702eaa0f591dea54c9bd4cd1.zip
refactor: rewrite localization for dynamic set and get
feat: medley localnames feat: integrate package minor updates fix: on errors with blog client init write correct type
Diffstat (limited to 'internal/router/handlers/api-v1-subs-put.go')
-rw-r--r--internal/router/handlers/api-v1-subs-put.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/router/handlers/api-v1-subs-put.go b/internal/router/handlers/api-v1-subs-put.go
index 32fba7e..12dc5cf 100644
--- a/internal/router/handlers/api-v1-subs-put.go
+++ b/internal/router/handlers/api-v1-subs-put.go
@@ -3,6 +3,7 @@ package handlers
import (
"github.com/SayaAndy/saya-today-web/internal/mailer"
"github.com/SayaAndy/saya-today-web/internal/router"
+ "github.com/SayaAndy/saya-today-web/l10n"
"github.com/gofiber/fiber/v2"
)
@@ -52,18 +53,18 @@ func (r *PutSubsHandler) Render(c *fiber.Ctx, supplements *router.Supplements, l
subscriptionTypeEnum = mailer.Specific
default:
templateMap["Status"] = "Failed"
- templateMap["Message"] = supplements.Localization[lang].UserProfile.SubscribeInvalidType
+ templateMap["Message"] = l10n.T.GetPath(lang, "UserProfile", "SubscribeInvalidType").(string)
return fiber.StatusUnprocessableEntity, nil
}
specificTags := c.FormValue("tags_picked")
if err = supplements.Mailer.Subscribe(supplements.Mailer.GetHash(c.IP()), subscriptionTypeEnum, specificTags); err != nil {
templateMap["Status"] = "Failed"
- templateMap["Message"] = supplements.Localization[lang].UserProfile.FailedToSubscribe
+ templateMap["Message"] = l10n.T.GetPath(lang, "UserProfile", "FailedToSubscribe").(string)
return fiber.StatusUnprocessableEntity, nil
}
templateMap["Status"] = "OK"
- templateMap["Message"] = supplements.Localization[lang].UserProfile.SubscribedSuccessfully
+ templateMap["Message"] = l10n.T.GetPath(lang, "UserProfile", "SubscribedSuccessfully").(string)
return fiber.StatusOK, nil
}