Add mention of the translation provider when translating a post (#19433)

This commit is contained in:
Claire 2022-10-24 18:37:57 +02:00 committed by GitHub
parent 8046cf34d6
commit 30453fab80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 5 deletions

View file

@ -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

View file

@ -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

View file

@ -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