about summary refs log tree commit diff
path: root/app/lib/translation_service.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-10-24 18:30:58 +0200
committerGitHub <noreply@github.com>2022-10-24 18:30:58 +0200
commit8046cf34d68209b39845e07a9d2db40926cc5512 (patch)
tree5c8343ae0f1a531ff4ff9559354c03bb7e66c6a2 /app/lib/translation_service.rb
parentdd76bbf8b7aef3aed6bb27a5c093211eebcdb24b (diff)
Change “Translate” button to only show up when a translation backend is configured (#19434)
* Change “Translate” button to only show up when a translation backend is configured

Fixes #19346

* Add `translation` attribute to /api/v2/instance to expose whether the translation feature is enabled

Fixes #19328
Diffstat (limited to 'app/lib/translation_service.rb')
-rw-r--r--app/lib/translation_service.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/lib/translation_service.rb b/app/lib/translation_service.rb
index 526e26ae5..285f30939 100644
--- a/app/lib/translation_service.rb
+++ b/app/lib/translation_service.rb
@@ -17,6 +17,10 @@ class TranslationService
     end
   end
 
+  def self.configured?
+    ENV['DEEPL_API_KEY'].present? || ENV['LIBRE_TRANSLATE_ENDPOINT'].present?
+  end
+
   def translate(_text, _source_language, _target_language)
     raise NotImplementedError
   end