diff options
author | Jan Holesovsky <kendy@collabora.com> | 2019-03-15 17:26:42 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2019-03-15 17:26:42 +0100 |
commit | 0087e9fbc3372f82f1ff39b67990e8cbb9157373 (patch) | |
tree | c24a82aba7e7ac592b8887be2d7867d56d38c2ae /wsd/FileServer.cpp | |
parent | Revert "wsd: preprocess javascript file for L10n" (diff) | |
download | online-0087e9fbc3372f82f1ff39b67990e8cbb9157373.tar.gz online-0087e9fbc3372f82f1ff39b67990e8cbb9157373.zip |
Revert "wsd: add boost::locale generation and caching"
This reverts commit c2aef686012c4130553a0d36f260b12615408126.
Diffstat (limited to 'wsd/FileServer.cpp')
-rw-r--r-- | wsd/FileServer.cpp | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp index b82becbf17..409a9c540e 100644 --- a/wsd/FileServer.cpp +++ b/wsd/FileServer.cpp @@ -38,9 +38,6 @@ #include <Poco/StreamCopier.h> #include <Poco/StringTokenizer.h> #include <Poco/URI.h> -#include <boost/locale.hpp> -#include <boost/locale/gnu_gettext.hpp> -#include <boost/exception/all.hpp> #include "Auth.hpp" #include <Common.hpp> @@ -429,18 +426,6 @@ void FileServerRequestHandler::handleRequest(const HTTPRequest& request, Poco::M sendError(404, request, socket, "404 - file not found!", "There seems to be a problem locating"); } - catch (const boost::exception& exc) - { - LOG_WRN("FileServerRequestHandler: " << boost::diagnostic_information(exc)); - sendError(404, request, socket, "404 - file not found!", - "There seems to be a localization problem"); - } - catch (const std::exception& exc) - { - LOG_WRN("FileServerRequestHandler: " << exc.what()); - sendError(404, request, socket, "404 - file not found!", - "Internal error"); - } } void FileServerRequestHandler::sendError(int errorCode, const Poco::Net::HTTPRequest& request, @@ -698,19 +683,11 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco:: documentSigningDiv = "<div id=\"document-signing-bar\"></div>"; } - std::string lang("en"); + std::string lang; + std::locale locale; std::ostringstream ostr; std::istringstream istr(preprocess); - auto pos = std::find_if(params.begin(), params.end(), - [](const std::pair<std::string, std::string>& it) { return it.first == "lang"; }); - if (pos != params.end()) - { - lang = pos->second; - } - - std::locale locale(LOOLWSD::Generator(lang + ".utf8")); - parse(locale, istr, ostr, [&](const std::string& var) { bool result = true; if (var == "ACCESS_TOKEN") @@ -1000,7 +977,8 @@ void FileServerRequestHandler::parse(const std::locale& locale, std::istringstre { if (state == ParseState::L10n) { - ostr << '\'' << boost::locale::gettext(varL10n.str().c_str(), locale) << '\''; + LOG_INF(locale.name()); + //ostr << '\'' << boost::locale::gettext(varL10n.str().c_str(), locale) << '\''; state = ParseState::None; } else ostr << token; |