21 lines
536 B
C++
21 lines
536 B
C++
#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
|
|
}
|