summaryrefslogtreecommitdiff
path: root/indra/newview/lltranslate.cpp
diff options
context:
space:
mode:
authorJonathan "Geenz" Goodman <geenz@geenzo.com>2023-03-31 10:54:22 -0700
committerJonathan "Geenz" Goodman <geenz@geenzo.com>2023-03-31 10:54:22 -0700
commit4e306c90666094a7450f4d6f3ed7c8b71527e393 (patch)
tree4e52cfe3cfc7df8060ec5336f53d91636986b43c /indra/newview/lltranslate.cpp
parentb44ad50f75724a5d9e53bd52d2724111568caf24 (diff)
parent7d144fcb2a1b0aff1b59e378c652649c3d03e94f (diff)
Merge branch 'DRTVWR-559' of https://github.com/secondlife/viewer into DRTVWR-559
Diffstat (limited to 'indra/newview/lltranslate.cpp')
-rw-r--r--indra/newview/lltranslate.cpp51
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()
{