From 8046cf34d68209b39845e07a9d2db40926cc5512 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 24 Oct 2022 18:30:58 +0200 Subject: Change “Translate” button to only show up when a translation backend is configured (#19434) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- app/lib/translation_service.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/lib') 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 -- cgit