lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |    7 
+++----
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 373a0470bd3559827cfe90bc24dea938872d302b
Author:     Mike Kaganski <[email protected]>
AuthorDate: Thu Oct 17 10:07:31 2024 +0500
Commit:     Miklos Vajna <[email protected]>
CommitDate: Thu Oct 17 13:38:38 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]>
    (cherry picked from commit 0794754e8540415eaac2dcf45069f500ed356859)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175041
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index 00dccc9b2db2..640a29cd3fc9 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -235,7 +235,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
@@ -244,7 +244,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);
 }
 
@@ -252,8 +251,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;

Reply via email to