0
0
Fork 0

Fix auto detect language for translate service (#19244)

This commit is contained in:
Yamagishi Kazutoshi 2022-09-28 06:33:56 +09:00 committed by GitHub
parent 2635c8dc5c
commit d86dd067ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 3 deletions

View file

@ -28,7 +28,7 @@ class TranslationService::DeepL < TranslationService
private
def request(text, source_language, target_language)
req = Request.new(:post, endpoint_url, form: { text: text, source_lang: source_language.upcase, target_lang: target_language, tag_handling: 'html' })
req = Request.new(:post, endpoint_url, form: { text: text, source_lang: source_language&.upcase, target_lang: target_language, tag_handling: 'html' })
req.add_headers('Authorization': "DeepL-Auth-Key #{@api_key}")
req
end