about summary refs log tree commit diff
path: root/app/lib/translation_service
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-10-31 18:25:34 +0100
committerGitHub <noreply@github.com>2022-10-31 18:25:34 +0100
commit968f34300681d8082cf2f824722a3945fc604b2d (patch)
tree910675cc3b8d9022f65bcfa9bee1acee6af8d0e4 /app/lib/translation_service
parent371563b0e249b6369e04709fb974a8e57413529f (diff)
parent1fe4e5e38c17a726e6aea5d6033139653e89a379 (diff)
Merge pull request #1876 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/lib/translation_service')
-rw-r--r--app/lib/translation_service/deepl.rb2
-rw-r--r--app/lib/translation_service/libre_translate.rb2
-rw-r--r--app/lib/translation_service/translation.rb2
3 files changed, 3 insertions, 3 deletions
diff --git a/app/lib/translation_service/deepl.rb b/app/lib/translation_service/deepl.rb
index b75b604a8..537fd24c0 100644
--- a/app/lib/translation_service/deepl.rb
+++ b/app/lib/translation_service/deepl.rb
@@ -46,7 +46,7 @@ class TranslationService::DeepL < TranslationService
 
     raise UnexpectedResponseError unless json.is_a?(Hash)
 
-    Translation.new(text: json.dig('translations', 0, 'text'), detected_source_language: json.dig('translations', 0, 'detected_source_language')&.downcase)
+    Translation.new(text: json.dig('translations', 0, 'text'), detected_source_language: json.dig('translations', 0, 'detected_source_language')&.downcase, provider: 'DeepL.com')
   rescue Oj::ParseError
     raise UnexpectedResponseError
   end
diff --git a/app/lib/translation_service/libre_translate.rb b/app/lib/translation_service/libre_translate.rb
index 8cf26f868..43576e306 100644
--- a/app/lib/translation_service/libre_translate.rb
+++ b/app/lib/translation_service/libre_translate.rb
@@ -37,7 +37,7 @@ class TranslationService::LibreTranslate < TranslationService
 
     raise UnexpectedResponseError unless json.is_a?(Hash)
 
-    Translation.new(text: json['translatedText'], detected_source_language: source_language)
+    Translation.new(text: json['translatedText'], detected_source_language: source_language, provider: 'LibreTranslate')
   rescue Oj::ParseError
     raise UnexpectedResponseError
   end
diff --git a/app/lib/translation_service/translation.rb b/app/lib/translation_service/translation.rb
index a55b82574..19318c7e9 100644
--- a/app/lib/translation_service/translation.rb
+++ b/app/lib/translation_service/translation.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
 
 class TranslationService::Translation < ActiveModelSerializers::Model
-  attributes :text, :detected_source_language
+  attributes :text, :detected_source_language, :provider
 end