ability to preserve translation
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
import { getUserLocale } from '$lib/i18n';
|
||||
import { interfaceRegionStore, invidiousAuthStore, invidiousInstanceStore } from '$lib/store';
|
||||
import {
|
||||
interfacePreserveTranslation,
|
||||
interfaceRegionStore,
|
||||
invidiousAuthStore,
|
||||
invidiousInstanceStore
|
||||
} from '$lib/store';
|
||||
import { get } from 'svelte/store';
|
||||
|
||||
export function buildPath(path: string): URL {
|
||||
@@ -12,8 +17,10 @@ export function setLocale(url: URL): URL {
|
||||
url.searchParams.set('region', region);
|
||||
}
|
||||
|
||||
const locale = getUserLocale();
|
||||
url.searchParams.set('hl', locale);
|
||||
if (!get(interfacePreserveTranslation)) {
|
||||
const locale = getUserLocale();
|
||||
url.searchParams.set('hl', locale);
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
interfaceSearchHistoryEnabled,
|
||||
interfaceSearchSuggestionsStore,
|
||||
searchHistoryStore,
|
||||
watchHistoryEnabledStore
|
||||
watchHistoryEnabledStore,
|
||||
interfacePreserveTranslation
|
||||
} from '../../store';
|
||||
import { isOwnBackend } from '$lib/shared';
|
||||
import ComboBox from '../ComboBox.svelte';
|
||||
@@ -257,6 +258,23 @@
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="field no-margin">
|
||||
<nav class="no-padding">
|
||||
<div class="max">
|
||||
<div>{$_('layout.preserveTranslation')}</div>
|
||||
</div>
|
||||
<label class="switch" tabindex="0">
|
||||
<input
|
||||
type="checkbox"
|
||||
bind:checked={$interfacePreserveTranslation}
|
||||
onclick={() => interfacePreserveTranslation.set(!$interfacePreserveTranslation)}
|
||||
role="switch"
|
||||
/>
|
||||
<span></span>
|
||||
</label>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
{#if Capacitor.getPlatform() == 'android'}
|
||||
<div class="field no-margin">
|
||||
<nav class="no-padding">
|
||||
|
||||
@@ -55,7 +55,8 @@ import {
|
||||
filterContentUrlStore,
|
||||
filterContentUrlAutoUpdateStore,
|
||||
interfaceAdvancedThemingStore,
|
||||
interfaceBorderRadiusStore
|
||||
interfaceBorderRadiusStore,
|
||||
interfacePreserveTranslation
|
||||
} from '$lib/store';
|
||||
import { isOwnBackend } from '$lib/shared';
|
||||
import { SUPPORTED_THEME_KEYS } from '$lib/shared/theme';
|
||||
@@ -290,6 +291,11 @@ export const persistedStores: PersistedStore<any>[] = [
|
||||
name: 'borderRadius',
|
||||
store: interfaceBorderRadiusStore,
|
||||
schema: zNumber
|
||||
},
|
||||
{
|
||||
name: 'preserveTranslation',
|
||||
store: interfacePreserveTranslation,
|
||||
schema: zBoolean
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -194,6 +194,7 @@
|
||||
"deleteAccount": "Delete account",
|
||||
"clickXmoreTimesToDelete": "Click {{clicksTillDelete}} more time(s) to delete",
|
||||
"historyEnabled": "Save watch history",
|
||||
"preserveTranslation": "Use original traslation",
|
||||
"theme": {
|
||||
"theme": "Theme",
|
||||
"darkMode": "Dark mode",
|
||||
|
||||
@@ -271,6 +271,11 @@ export const interfaceBorderRadiusStore: Writable<number> = persist(
|
||||
createStorage(),
|
||||
'borderRadius'
|
||||
);
|
||||
export const interfacePreserveTranslation: Writable<boolean> = persist(
|
||||
writable(false),
|
||||
createStorage(),
|
||||
'preserveTranslation'
|
||||
);
|
||||
|
||||
export const sponsorBlockStore = persist(writable(true), createStorage(), 'sponsorBlock');
|
||||
export const sponsorBlockUrlStore: Writable<string | null | undefined> = persist(
|
||||
|
||||
Reference in New Issue
Block a user