about summary refs log tree commit diff
path: root/app/javascript/mastodon/components/status_content.js
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/javascript/mastodon/components/status_content.js
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/javascript/mastodon/components/status_content.js')
-rw-r--r--app/javascript/mastodon/components/status_content.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/javascript/mastodon/components/status_content.js b/app/javascript/mastodon/components/status_content.js
index 6ad3e018a..0ed79e658 100644
--- a/app/javascript/mastodon/components/status_content.js
+++ b/app/javascript/mastodon/components/status_content.js
@@ -6,7 +6,7 @@ import Permalink from './permalink';
 import classnames from 'classnames';
 import PollContainer from 'mastodon/containers/poll_container';
 import Icon from 'mastodon/components/icon';
-import { autoPlayGif, languages as preloadedLanguages } from 'mastodon/initial_state';
+import { autoPlayGif, languages as preloadedLanguages, translationEnabled } from 'mastodon/initial_state';
 
 const MAX_HEIGHT = 642; // 20px * 32 (+ 2px padding at the top)
 
@@ -181,7 +181,7 @@ class StatusContent extends React.PureComponent {
     const hidden = this.props.onExpandedToggle ? !this.props.expanded : this.state.hidden;
     const renderReadMore = this.props.onClick && status.get('collapsed');
     const renderViewThread = this.props.showThread && status.get('in_reply_to_id') && status.get('in_reply_to_account_id') === status.getIn(['account', 'id']);
-    const renderTranslate = this.context.identity.signedIn && this.props.onTranslate && ['public', 'unlisted'].includes(status.get('visibility')) && status.get('contentHtml').length > 0 && status.get('language') !== null && intl.locale !== status.get('language');
+    const renderTranslate = translationEnabled && this.context.identity.signedIn && this.props.onTranslate && ['public', 'unlisted'].includes(status.get('visibility')) && status.get('contentHtml').length > 0 && status.get('language') !== null && intl.locale !== status.get('language');
     const language = preloadedLanguages.find(lang => lang[0] === status.get('language'));
     const languageName = language ? language[2] : status.get('language');