diff --git a/src/pages/settings.css b/src/pages/settings.css index 6c4428da..1a4d8230 100644 --- a/src/pages/settings.css +++ b/src/pages/settings.css @@ -59,6 +59,9 @@ #settings-container div { vertical-align: middle; } +#settings-container section > ul > li .sub-section hr { + margin: 8px 0; +} #settings-container section select { padding: 4px; diff --git a/src/pages/settings.jsx b/src/pages/settings.jsx index 42592a8f..f54aedc3 100644 --- a/src/pages/settings.jsx +++ b/src/pages/settings.jsx @@ -255,42 +255,43 @@ function Settings({ onClose }) { : '' }`} > - +
+ +
+

- - Hide "Translate" button for - {snapStates.settings.contentTranslationHideLanguages - .length > 0 && ( - <> - {' '} - ( - { - snapStates.settings.contentTranslationHideLanguages - .length - } - ) - - )} - : - + Hide "Translate" button for + {snapStates.settings.contentTranslationHideLanguages.length > + 0 && ( + <> + {' '} + ( + { + snapStates.settings.contentTranslationHideLanguages + .length + } + ) + + )} + :

{targetLanguages.map((lang) => (

-

+

Note: This feature uses an external API to translate, powered by{' '} @@ -331,6 +332,28 @@ function Settings({ onClose }) { .

+
+
+ +

+ + Automatically show translation for posts in timeline. Only + works for short posts without content warning, + media and poll. + +

+
  • diff --git a/src/utils/states.js b/src/utils/states.js index fb76cc41..6b8e281a 100644 --- a/src/utils/states.js +++ b/src/utils/states.js @@ -52,6 +52,8 @@ const states = proxy({ store.account.get('settings-contentTranslationTargetLanguage') || null, contentTranslationHideLanguages: store.account.get('settings-contentTranslationHideLanguages') || [], + contentTranslationAutoInline: + store.account.get('settings-contentTranslationAutoInline') ?? false, cloakMode: store.account.get('settings-cloakMode') ?? false, }, }); @@ -80,6 +82,9 @@ subscribe(states, (changes) => { if (path.join('.') === 'settings.contentTranslation') { store.account.set('settings-contentTranslation', !!value); } + if (path.join('.') === 'settings.contentTranslationAutoInline') { + store.account.set('settings-contentTranslationAutoInline', !!value); + } if (path.join('.') === 'settings.contentTranslationTargetLanguage') { console.log('SET', value); store.account.set('settings-contentTranslationTargetLanguage', value);