feat: autoTranslate preferences
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Kieran 2023-11-06 14:16:19 +00:00
parent 3d69762359
commit de0e58b657
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
5 changed files with 32 additions and 1 deletions

View File

@ -83,7 +83,7 @@ export function NoteContextMenu({ ev, ...props }: NosteContextMenuProps) {
useEffect(() => {
const sub = getCurrentSubscription(login.subscriptions);
if (sub?.type === SubscriptionType.Premium) {
if (sub?.type === SubscriptionType.Premium && (login.preferences.autoTranslate ?? true)) {
translate();
}
}, []);

View File

@ -91,6 +91,11 @@ export interface UserPreferences {
* Check event signatures
*/
checkSigs: boolean;
/**
* Auto-translate when available
*/
autoTranslate?: boolean;
}
export const DefaultPreferences = {
@ -110,4 +115,5 @@ export const DefaultPreferences = {
showBadges: false,
showStatus: true,
checkSigs: false,
autoTranslate: true,
} as UserPreferences;

View File

@ -182,6 +182,23 @@ const PreferencesPage = () => {
/>
</div>
</div>
<div className="flex justify-between w-max">
<div className="flex flex-col g8">
<h4>
<FormattedMessage defaultMessage="Auto Translate" />
</h4>
<small>
<FormattedMessage defaultMessage="Automatically translate notes to your local language" />
</small>
</div>
<div>
<input
type="checkbox"
checked={perf.autoTranslate}
onChange={e => updatePreferences(login, { ...perf, autoTranslate: e.target.checked })}
/>
</div>
</div>
<div className="flex justify-between w-max">
<div className="flex flex-col g8">
<h4>

View File

@ -552,6 +552,9 @@
"IVbtTS": {
"defaultMessage": "Zap all {n} sats"
},
"IWz1ta": {
"defaultMessage": "Auto Translate"
},
"Ig9/a1": {
"defaultMessage": "Sent {n} sats to {name}"
},
@ -917,6 +920,9 @@
"WONP5O": {
"defaultMessage": "Find your twitter follows on nostr (Data provided by {provider})"
},
"WmZhfL": {
"defaultMessage": "Automatically translate notes to your local language"
},
"WvGmZT": {
"defaultMessage": "npub / nprofile / nostr address"
},

View File

@ -181,6 +181,7 @@
"INSqIz": "Twitter username...",
"IUZC+0": "This means that nobody can modify notes which you have created and everybody can easily verify that the notes they are reading are created by you.",
"IVbtTS": "Zap all {n} sats",
"IWz1ta": "Auto Translate",
"Ig9/a1": "Sent {n} sats to {name}",
"IoQq+a": "Click here to load anyway",
"Ix8l+B": "Trending Notes",
@ -300,6 +301,7 @@
"W2PiAr": "{n} Blocked",
"W9355R": "Unmute",
"WONP5O": "Find your twitter follows on nostr (Data provided by {provider})",
"WmZhfL": "Automatically translate notes to your local language",
"WvGmZT": "npub / nprofile / nostr address",
"WxthCV": "e.g. Jack",
"X7xU8J": "nsec, npub, nip-05, hex, mnemonic",