lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
New commits: commit 0794754e8540415eaac2dcf45069f500ed356859 Author: Mike Kaganski <[email protected]> AuthorDate: Thu Oct 17 10:07:31 2024 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Thu Oct 17 09:12:54 2024 +0200 Optimize a bit: only create std::locale once in parseDudenResponse Change-Id: If1aee9fa908b4ad730d858738f3e472a17fd235a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175039 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx index 5bc7ccf98c3b..d8a9da3fd7a4 100644 --- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx +++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx @@ -242,7 +242,7 @@ uno::Sequence<SingleProofreadingError> parseJson(std::string&& json, std::string return {}; } -OUString DudenTypeToComment(const std::string& type, const Locale& rLocale) +OUString DudenTypeToComment(const std::string& type, const std::locale& loc) { // TODO: consider also "errorcode", some values of which are explained // at https://main.dks.epc.de/doc/Relnotes.html @@ -251,7 +251,6 @@ OUString DudenTypeToComment(const std::string& type, const Locale& rLocale) id = STR_DESCRIPTION_GRAMMAR_ERROR; else if (type == "style") id = STR_DESCRIPTION_STYLE_ERROR; - std::locale loc(Translate::Create("svt", LanguageTag(rLocale))); return Translate::get(id, loc); } @@ -259,8 +258,8 @@ void parseDudenResponse(ProofreadingResult& rResult, std::string&& aJSONBody) { rResult.aErrors = parseJson( std::move(aJSONBody), "check-positions", - [& locale = rResult.aLocale](const boost::property_tree::ptree& rPos, - SingleProofreadingError& rError) { + [locale = Translate::Create("svt", LanguageTag(rResult.aLocale))]( + const boost::property_tree::ptree& rPos, SingleProofreadingError& rError) { rError.nErrorStart = rPos.get<int>("offset", 0); rError.nErrorLength = rPos.get<int>("length", 0); rError.nErrorType = text::TextMarkupType::PROOFREADING;
