diff --git a/src/components/status.jsx b/src/components/status.jsx index 9c0feee5..1b8a85d6 100644 --- a/src/components/status.jsx +++ b/src/components/status.jsx @@ -79,6 +79,7 @@ function Status({ readOnly, contentTextWeight, enableTranslate, + forceTranslate: _forceTranslate, previewMode, allowFilters, onMediaClick, @@ -233,7 +234,7 @@ function Status({ ); } - const [forceTranslate, setForceTranslate] = useState(false); + const [forceTranslate, setForceTranslate] = useState(_forceTranslate); const targetLanguage = getTranslateTargetLanguage(true); const contentTranslationHideLanguages = snapStates.settings.contentTranslationHideLanguages || []; @@ -403,6 +404,14 @@ function Status({ } }; + const differentLanguage = + language && + language !== targetLanguage && + !match([language], [targetLanguage]) && + !contentTranslationHideLanguages.find( + (l) => language === l || match([language], [l]), + ); + const menuInstanceRef = useRef(); const StatusMenuItems = ( <> @@ -530,7 +539,7 @@ function Status({ )} - {enableTranslate && ( + {enableTranslate ? ( { @@ -540,6 +549,15 @@ function Status({ Translate + ) : ( + (!language || differentLanguage) && ( + + + Translate + + ) )} {((!isSizeLarge && sameInstance) || enableTranslate) && } @@ -996,14 +1014,7 @@ function Status({ }} /> )} - {((enableTranslate && - !!content.trim() && - language && - language !== targetLanguage && - !match([language], [targetLanguage]) && - !contentTranslationHideLanguages.find( - (l) => language === l || match([language], [l]), - )) || + {((enableTranslate && !!content.trim() && differentLanguage) || forceTranslate) && ( 0; const [viewMode, setViewMode] = useState(searchParams.get('view')); + const translate = !!parseInt(searchParams.get('translate')); const { masto, instance } = api({ instance: propInstance }); const { masto: currentMasto, @@ -801,6 +802,7 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) { withinContext size="l" enableTranslate + forceTranslate={translate} /> {uiState !== 'loading' && !authenticated ? (