diff options
author | Dave Parks <davep@lindenlab.com> | 2023-03-31 11:57:48 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2023-03-31 11:57:48 -0500 |
commit | 7d144fcb2a1b0aff1b59e378c652649c3d03e94f (patch) | |
tree | de3bfe3ce90677cc4d7ab25b8aeaf5853c009068 /indra/newview/lltranslate.cpp | |
parent | 0fe09bd968b987605123e99efb2fa040a988a942 (diff) | |
parent | e4173ea5cc1ef9b1677ac87a0f7c8acbe73414ee (diff) |
Merge branch 'DRTVWR-559' of github.com:secondlife/viewer into DRTVWR-559
Diffstat (limited to 'indra/newview/lltranslate.cpp')
-rw-r--r-- | indra/newview/lltranslate.cpp | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index a2c696c762..34d3ed8bb1 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -36,7 +36,7 @@ #include "llversioninfo.h" #include "llviewercontrol.h" #include "llcoros.h" -#include "reader.h" +#include "json/reader.h" #include "llcorehttputil.h" #include "llurlregistry.h" @@ -546,6 +546,18 @@ void LLBingTranslationHandler::verifyKey(const std::string &key, LLTranslate::Ke } //========================================================================= +LLTranslate::LLTranslate(): + mCharsSeen(0), + mCharsSent(0), + mFailureCount(0), + mSuccessCount(0) +{ +} + +LLTranslate::~LLTranslate() +{ +} + /*static*/ void LLTranslate::translateMessage(const std::string &from_lang, const std::string &to_lang, const std::string &mesg, TranslationSuccess_fn success, TranslationFailure_fn failure) @@ -634,6 +646,43 @@ bool LLTranslate::isTranslationConfigured() return getPreferredHandler().isConfigured(); } +void LLTranslate::logCharsSeen(size_t count) +{ + mCharsSeen += count; +} + +void LLTranslate::logCharsSent(size_t count) +{ + mCharsSent += count; +} + +void LLTranslate::logSuccess(S32 count) +{ + mSuccessCount += count; +} + +void LLTranslate::logFailure(S32 count) +{ + mFailureCount += count; +} + +LLSD LLTranslate::asLLSD() const +{ + LLSD res; + bool on = gSavedSettings.getBOOL("TranslateChat"); + res["on"] = on; + res["chars_seen"] = (S32) mCharsSeen; + if (on) + { + res["chars_sent"] = (S32) mCharsSent; + res["success_count"] = mSuccessCount; + res["failure_count"] = mFailureCount; + res["language"] = getTranslateLanguage(); + res["service"] = gSavedSettings.getString("TranslationService"); + } + return res; +} + // static LLTranslationAPIHandler& LLTranslate::getPreferredHandler() { |