123456789101112131415161718192021 |
- #include "languagehandlermiddleware.h"
- void LanguageHandler::before_handle(crow::request& req, crow::response& /*res*/, context& ctx)
- {
- for (const auto& h: req.headers)
- {
- if (h.first == "Accept-Language" or h.first == "accept-language")
- {
- if (h.second.find("ru") != std::string::npos)
- {
- ctx.lang = Notepad::Lang::ru;
- }
- }
- }
- }
- void LanguageHandler::after_handle(crow::request& /*req*/, crow::response& /*res*/, context& /*ctx*/)
- {
- // nothing
- }
|