locale for web app (#334)
* locale for web app * more translations * Rename profiles service to avoid locale conflict * More translation work * Lint fix --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
This commit is contained in:
1 parent
019fde1e67
commit
42dadec020
54 files changed
+538
-151
No files matched your search
@@ -22,10 +22,12 @@
|
||||
import LinkDragDrop from "lib/LinkDragDrop.svelte";
|
||||
import BookmarksScreen from "lib/Screens/BookmarksScreen.svelte";
|
||||
import RemoteControlScreen from "lib/Screens/RemoteControlScreen.svelte";
|
||||
import { fetchLocale } from "lib/Api/Locale";
|
||||
|
||||
onMount(async () => {
|
||||
PlayletApi.getState().then((value) => {
|
||||
playletStateStore.set(value);
|
||||
fetchLocale(value.device?.current_locale);
|
||||
});
|
||||
|
||||
PlayletApi.getHomeLayout().then((value) => {
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import { tr } from "lib/Stores";
|
||||
import { PlayletApi } from "./PlayletApi";
|
||||
|
||||
export async function fetchLocale(locale: string) {
|
||||
try {
|
||||
if (!locale) {
|
||||
return;
|
||||
}
|
||||
const localeFile = await PlayletApi.getLocale(locale);
|
||||
const parser = new DOMParser();
|
||||
const xmlDoc = parser.parseFromString(localeFile, "text/xml");
|
||||
const context = xmlDoc.getElementsByTagName("context");
|
||||
if (context.length === 0) {
|
||||
return;
|
||||
}
|
||||
const messages = context[0].getElementsByTagName("message");
|
||||
if (messages.length === 0) {
|
||||
return;
|
||||
}
|
||||
const translations = {};
|
||||
for (let i = 0; i < messages.length; i++) {
|
||||
const message = messages[i];
|
||||
const source = message.getElementsByTagName("source");
|
||||
if (source.length === 0) {
|
||||
continue;
|
||||
}
|
||||
const translation = message.getElementsByTagName("translation");
|
||||
if (translation.length === 0) {
|
||||
continue;
|
||||
}
|
||||
translations[source[0].textContent] = translation[0].textContent;
|
||||
}
|
||||
tr.set((s) => translations[s] || s);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,11 @@ export class PlayletApi {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
static async getLocale(locale: string) {
|
||||
const response = await fetch(`${PlayletApi.host()}/locale/${locale}/translations.ts`);
|
||||
return await response.text();
|
||||
}
|
||||
|
||||
static async getPreferencesFile() {
|
||||
const response = await fetch(`${PlayletApi.host()}/config/preferences.json5`);
|
||||
return await response.json();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import BookmarksIcon from "../assets/star-icon.svg.svelte";
|
||||
import RemoteIcon from "../assets/remote-control.svg.svelte";
|
||||
|
||||
import { appStateStore } from "lib/Stores";
|
||||
import { appStateStore, tr } from "lib/Stores";
|
||||
import { ScreenNames, type AppState } from "lib/Types";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<div class="h-6">
|
||||
<SearchIcon />
|
||||
</div>
|
||||
<span class="text-xs">Search</span>
|
||||
<span class="text-xs">{$tr("Search")}</span>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("home")}
|
||||
@@ -66,7 +66,7 @@
|
||||
<div class="h-6">
|
||||
<HomeIcon />
|
||||
</div>
|
||||
<span class="text-xs">Home</span>
|
||||
<span class="text-xs">{$tr("Home")}</span>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("bookmarks")}
|
||||
@@ -75,7 +75,7 @@
|
||||
<div class="h-6">
|
||||
<BookmarksIcon />
|
||||
</div>
|
||||
<span class="text-xs">Bookmarks</span>
|
||||
<span class="text-xs">{$tr("Bookmarks")}</span>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("settings")}
|
||||
@@ -84,7 +84,7 @@
|
||||
<div class="h-6">
|
||||
<SettingsIcon />
|
||||
</div>
|
||||
<span class="text-xs">Settings</span>
|
||||
<span class="text-xs">{$tr("Settings")}</span>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("remote")}
|
||||
@@ -93,7 +93,7 @@
|
||||
<div class="h-6">
|
||||
<RemoteIcon />
|
||||
</div>
|
||||
<span class="text-xs">Remote</span>
|
||||
<span class="text-xs">{$tr("Remote")}</span>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("info")}
|
||||
@@ -102,6 +102,6 @@
|
||||
<div class="h-6">
|
||||
<InfoIcon />
|
||||
</div>
|
||||
<span class="text-xs">Info</span>
|
||||
<span class="text-xs">{$tr("Info")}</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
import { playletStateStore } from "lib/Stores";
|
||||
import { playletStateStore, tr } from "lib/Stores";
|
||||
import { InvidiousApi } from "lib/Api/InvidiousApi";
|
||||
import VideoCastDialog from "./VideoFeed/VideoCastDialog.svelte";
|
||||
import ChannelCastDialog from "./VideoFeed/ChannelCastDialog.svelte";
|
||||
@@ -17,15 +17,10 @@
|
||||
let videoMetadata;
|
||||
let channelMetadata;
|
||||
|
||||
let tvName = "Roku TV";
|
||||
let invidiousInstance;
|
||||
|
||||
let invidiousApi = new InvidiousApi();
|
||||
|
||||
playletStateStore.subscribe((value) => {
|
||||
tvName = value?.device?.friendly_name ?? "Roku TV";
|
||||
invidiousApi.instance = invidiousInstance =
|
||||
value?.invidious?.current_instance;
|
||||
invidiousApi.instance = value?.invidious?.current_instance;
|
||||
});
|
||||
|
||||
onMount(async () => {
|
||||
@@ -199,7 +194,7 @@
|
||||
: 'hidden'} fixed w-full h-full bg-base-100/80 z-50 flex justify-center items-center"
|
||||
>
|
||||
{#if isDragging}
|
||||
<div class="text-2xl font-bold">Drop a YouTube link here</div>
|
||||
<div class="text-2xl font-bold">{$tr("Drop a YouTube link here")}</div>
|
||||
{:else if isLoading}
|
||||
<span class="loading loading-spinner loading-md" />
|
||||
{/if}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { playletStateStore } from "lib/Stores";
|
||||
import { playletStateStore, tr } from "lib/Stores";
|
||||
import { PlayletApi } from "./Api/PlayletApi";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<dialog bind:this={modal} class="modal">
|
||||
<form method="dialog" class="modal-box bg-base-100">
|
||||
<div class="flex flex-col items-center">
|
||||
<div class="text-xl font-medium m-4">Profiles</div>
|
||||
<div class="text-xl font-medium m-4">{$tr("Profiles")}</div>
|
||||
|
||||
{#each profiles as profile}
|
||||
<div class="collapse collapse-arrow bg-base-300 m-1">
|
||||
@@ -109,12 +109,12 @@
|
||||
{#if profile.id !== currentProfile?.id}
|
||||
<button
|
||||
on:click={() => activate(profile.id)}
|
||||
class="btn btn-primary m-1">Activate</button
|
||||
class="btn btn-primary m-1">{$tr("Activate")}</button
|
||||
>
|
||||
{/if}
|
||||
<button
|
||||
on:click={() => logout(profile.id)}
|
||||
class="btn btn-primary m-1">Logout</button
|
||||
class="btn btn-primary m-1">{$tr("Logout")}</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
@@ -122,15 +122,15 @@
|
||||
<div class="flex items-center">
|
||||
<button class="btn btn-primary" on:click={login}>
|
||||
<div class="">
|
||||
<div class="text-m">Login to Invidious</div>
|
||||
<div class="text-m">{$tr("Login to Invidious")}</div>
|
||||
<div class="text-xs font-light">{currentInstance}</div>
|
||||
</div>
|
||||
</button>
|
||||
<button class="btn m-6" on:click={close}>Close</button>
|
||||
<button class="btn m-6" on:click={close}>{$tr("Close")}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button on:click={close}>Close</button>
|
||||
<button on:click={close}>{$tr("Close")}</button>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import VideoListRow from "lib/VideoFeed/VideoListRow.svelte";
|
||||
import { bookmarksStore } from "lib/Stores";
|
||||
import { bookmarksStore, tr } from "lib/Stores";
|
||||
|
||||
export let visibility: boolean;
|
||||
</script>
|
||||
@@ -10,12 +10,13 @@
|
||||
<div
|
||||
class="flex flex-col items-center justify-start h-screen w-2/3 mx-auto"
|
||||
>
|
||||
<div class="text-2xl font-bold text-gray-500">No Bookmarks</div>
|
||||
<div class="text-2xl font-bold text-gray-500">{$tr("No Bookmarks")}</div>
|
||||
<div class="text-gray-500 text-center">
|
||||
You currently have no bookmarks.<br />
|
||||
To add bookmarks, select a video, playlist or channel, and add a bookmark.<br
|
||||
/>
|
||||
Please note that Bookmarks is an experimental feature.
|
||||
{$tr("You currently have no bookmarks.")}<br />
|
||||
{$tr(
|
||||
"To add bookmarks, select a video, playlist or channel, and add a bookmark."
|
||||
)}<br />
|
||||
{$tr("Please note that Bookmarks is an experimental feature.")}
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { getHost } from "lib/Api/Host";
|
||||
import { playletStateStore } from "lib/Stores";
|
||||
import { playletStateStore, tr } from "lib/Stores";
|
||||
|
||||
export let visibility: boolean;
|
||||
|
||||
@@ -87,6 +87,8 @@
|
||||
const feedbackTitle = encodeURIComponent("[Feedback] Playlet");
|
||||
let githubUrlIssue = "https://github.com/iBicha/playlet/issues/new";
|
||||
let mailToUrl = "mailto:brahim.hadriche@gmail.com";
|
||||
const feedbackMessageRaw =
|
||||
"You have feedback? Let us know by %IssueStart%creating an issue on Github%IssueEnd% or by %EmailStart%sending an email%EmailEnd%.";
|
||||
|
||||
playletStateStore.subscribe((value) => {
|
||||
appInfo = value.app || {};
|
||||
@@ -141,17 +143,17 @@ ${JSON.stringify(profilesInfo, null, 2)}
|
||||
|
||||
<div class={visibility ? "" : "hidden"}>
|
||||
<div class="text-base text-center m-8">
|
||||
Thank you for using Playlet.<br /> You have feedback? Let us know by
|
||||
<a
|
||||
class="link"
|
||||
href={githubUrlIssue}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">creating an issue on Github</a
|
||||
>
|
||||
or by
|
||||
<a class="link" href={mailToUrl} target="_blank" rel="noopener noreferrer"
|
||||
>sending an email</a
|
||||
>.
|
||||
{@html $tr(feedbackMessageRaw)
|
||||
.replace(
|
||||
"%IssueStart%",
|
||||
`<a class="link" href="${githubUrlIssue}" target="_blank" rel="noopener noreferrer">`
|
||||
)
|
||||
.replace("%IssueEnd%", "</a>")
|
||||
.replace(
|
||||
"%EmailStart%",
|
||||
`<a class="link" href="${mailToUrl}" target="_blank" rel="noopener noreferrer">`
|
||||
)
|
||||
.replace("%EmailEnd%", "</a>")}
|
||||
</div>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table">
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { tr } from "lib/Stores";
|
||||
|
||||
let modal;
|
||||
|
||||
export let label = "Filters";
|
||||
export let label = $tr("Filters");
|
||||
|
||||
export const filters = {
|
||||
date: "",
|
||||
@@ -28,7 +30,7 @@
|
||||
count += filters.features.length;
|
||||
count += filters.sort_by ? 1 : 0;
|
||||
|
||||
label = `Filters` + `${count > 0 ? ` (${count})` : ""}`;
|
||||
label = $tr("Filters") + `${count > 0 ? ` (${count})` : ""}`;
|
||||
}
|
||||
|
||||
const options = {
|
||||
@@ -239,12 +241,12 @@
|
||||
<button
|
||||
class="btn btn-outline"
|
||||
type="button"
|
||||
on:click={() => modal.close()}>Close</button
|
||||
on:click={() => modal.close()}>{$tr("Close")}</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>Close</button>
|
||||
<button>{$tr("Close")}</button>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { InvidiousApi } from "lib/Api/InvidiousApi";
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { playletStateStore, searchHistoryStore } from "lib/Stores";
|
||||
import { playletStateStore, searchHistoryStore, tr } from "lib/Stores";
|
||||
import VideoCell from "lib/VideoFeed/VideoCell.svelte";
|
||||
import PlaylistCell from "lib/VideoFeed/PlaylistCell.svelte";
|
||||
import ChannelCell from "lib/VideoFeed/ChannelCell.svelte";
|
||||
@@ -125,7 +125,7 @@
|
||||
<input
|
||||
type="search"
|
||||
dir="auto"
|
||||
placeholder="Search..."
|
||||
placeholder="{$tr('Search')}..."
|
||||
class="join-item input w-full border border-neutral rounded-full"
|
||||
bind:this={searchBox}
|
||||
bind:value={searchBoxText}
|
||||
@@ -205,7 +205,7 @@
|
||||
await searchVideos();
|
||||
}}
|
||||
>
|
||||
Load more
|
||||
{$tr("Load more")}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { userPreferencesStore } from "lib/Stores";
|
||||
import { tr, userPreferencesStore } from "lib/Stores";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<div class="form-control m-5">
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text {textSizes[level]}">{displayText}</div>
|
||||
<div class="label-text {textSizes[level]}">{$tr(displayText)}</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
name={key}
|
||||
@@ -32,5 +32,5 @@
|
||||
class="checkbox"
|
||||
/>
|
||||
</label>
|
||||
<div class="text-xs text-gray-500">{@html description}</div>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
</div>
|
||||
+7
-5
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { searchHistoryStore } from "lib/Stores";
|
||||
import { searchHistoryStore, tr } from "lib/Stores";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
@@ -13,14 +14,15 @@
|
||||
async function clearSeachHistory() {
|
||||
await PlayletApi.clearSearchHistory();
|
||||
searchHistoryStore.set([]);
|
||||
alert("Search history cleared.");
|
||||
|
||||
alert(get(tr)("Search history cleared."));
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{displayText}</div>
|
||||
<div class="text-xs text-gray-500">{@html description}</div>
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
<button class="btn m-1" on:click={clearSeachHistory}
|
||||
>Clear search history</button
|
||||
>{$tr("Clear search history")}</button
|
||||
>
|
||||
</div>
|
||||
@@ -2,6 +2,7 @@
|
||||
import {
|
||||
homeLayoutFileStore,
|
||||
homeLayoutStore,
|
||||
tr,
|
||||
userPreferencesStore,
|
||||
} from "lib/Stores";
|
||||
import ArrowUpIcon from "assets/remote-control/arrow-up.svg.svelte";
|
||||
@@ -84,10 +85,10 @@
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{displayText}</div>
|
||||
<div class="text-xs text-gray-500">{@html description}</div>
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
<button class="btn m-1" on:click={openHomeScreenEditor}
|
||||
>Edit home screen</button
|
||||
>{$tr("Edit home screen")}</button
|
||||
>
|
||||
</div>
|
||||
|
||||
@@ -110,7 +111,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text">{homeLayout[item.id].title}</div>
|
||||
<div class="label-text">{$tr(homeLayout[item.id].title)}</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
name={item.id}
|
||||
@@ -134,12 +135,12 @@
|
||||
{/each}
|
||||
</table>
|
||||
<form method="dialog" class="flex justify-center space-x-2">
|
||||
<button class="btn btn-primary" on:click={save}>Save</button>
|
||||
<button class="btn btn-primary">Close</button>
|
||||
<button class="btn btn-primary" on:click={save}>{$tr("Save")}</button>
|
||||
<button class="btn btn-primary">{$tr("Close")}</button>
|
||||
</form>
|
||||
{/if}
|
||||
</div>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>Close</button>
|
||||
<button>{$tr("Close")}</button>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { userPreferencesStore } from "lib/Stores";
|
||||
import { tr, userPreferencesStore } from "lib/Stores";
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
export let displayText: string = "";
|
||||
export let key: string = "";
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<div class="form-control m-5">
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text {textSizes[level]}">{displayText}</div>
|
||||
<div class="label-text {textSizes[level]}">{$tr(displayText)}</div>
|
||||
<div class="join mt-2 mb-2">
|
||||
<button
|
||||
class="join-item btn btn-sm btn-primary"
|
||||
@@ -52,5 +52,5 @@
|
||||
</button>
|
||||
</div>
|
||||
</label>
|
||||
<div class="text-xs text-gray-500">{@html description}</div>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
</div>
|
||||
+18
-9
@@ -1,8 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { playletStateStore } from "lib/Stores";
|
||||
import { playletStateStore, tr } from "lib/Stores";
|
||||
import { ExternalControlProtocol } from "lib/Api/ExternalControlProtocol";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
let selectedRelease = "";
|
||||
let releases = [];
|
||||
@@ -65,23 +66,31 @@
|
||||
if (version === "") {
|
||||
version = "latest";
|
||||
}
|
||||
|
||||
const trFn = get(tr);
|
||||
|
||||
if (
|
||||
confirm(
|
||||
`Are you sure you want to change the Playlet Library version to "${version}"?\nThis will restart Playlet.`
|
||||
)
|
||||
trFn(
|
||||
"Are you sure you want to change the Playlet Library version to %1"
|
||||
).replace("%1", version)
|
||||
) +
|
||||
`\n` +
|
||||
trFn("This will restart Playlet.")
|
||||
) {
|
||||
await PlayletApi.setPlayletLibVersion(selectedRelease);
|
||||
alert("Playlet Library version set. Playlet will now restart.");
|
||||
alert(trFn("Playlet Library version changed. Playlet will now restart."));
|
||||
await ExternalControlProtocol.restartApp(appId);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class="text-lg">Playlet Library version</div>
|
||||
<div class="text-lg">{$tr("Playlet Library version")}</div>
|
||||
<div class="text-xs text-gray-500">
|
||||
The version of Playlet Lib to use. These correspond to tagged releases on
|
||||
Github. Releases that do not have a playlet-lib.zip file are disabled.
|
||||
{$tr(
|
||||
"The version of Playlet Lib to use. These correspond to tagged releases on Github. Releases that do not have a playlet-lib.zip file are disabled."
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div class="join w-full m-1">
|
||||
@@ -89,13 +98,13 @@
|
||||
bind:value={selectedRelease}
|
||||
class="select select-bordered join-item w-full mr-1"
|
||||
>
|
||||
<option selected value="">latest (default)</option>
|
||||
<option selected value=""></option>
|
||||
{#each releases as release}
|
||||
<option disabled={!release.enabled} value={release.name}
|
||||
>{release.name}</option
|
||||
>
|
||||
{/each}
|
||||
</select>
|
||||
<button class="join-item btn" on:click={apply}>Apply</button>
|
||||
<button class="join-item btn" on:click={apply}>{$tr("Apply")}</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { userPreferencesStore } from "lib/Stores";
|
||||
import { tr, userPreferencesStore } from "lib/Stores";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
@@ -24,13 +24,13 @@
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{displayText}</div>
|
||||
<div class="text-xs text-gray-500">{@html description}</div>
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
|
||||
{#each options as option}
|
||||
<div class="form-control">
|
||||
<label class="label cursor-pointer">
|
||||
<span class="label-text">{option.displayText}</span>
|
||||
<span class="label-text">{$tr(option.displayText)}</span>
|
||||
<input
|
||||
type="radio"
|
||||
name={key}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { userPreferencesStore } from "lib/Stores";
|
||||
import { tr, userPreferencesStore } from "lib/Stores";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
const invidiousPublicInstancesLink = `<a class="link" href="https://api.invidious.io" target="_blank" rel="noopener noreferrer">https://api.invidious.io</a>`;
|
||||
|
||||
export let displayText: string = "";
|
||||
export let key: string = "";
|
||||
@@ -26,8 +27,14 @@
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{displayText}</div>
|
||||
<div class="text-xs text-gray-500">{@html description}</div>
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">
|
||||
<!-- TODO:P2 this should not be hardcoded here -->
|
||||
{@html $tr(description).replace(
|
||||
"$INVIDIOUS_PUBLIC_INSTANCES",
|
||||
invidiousPublicInstancesLink
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div class="join w-full m-1">
|
||||
<input
|
||||
@@ -38,7 +45,7 @@
|
||||
class="join-item input w-full mr-1"
|
||||
/>
|
||||
{#if inputValue !== currentValue}
|
||||
<button class="join-item btn" on:click={save}>Save</button>
|
||||
<button class="join-item btn" on:click={save}>{$tr("Save")}</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -6,6 +6,7 @@
|
||||
import RadioControl from "lib/Screens/Settings/SettingControls/RadioControl.svelte";
|
||||
import StringControl from "lib/Screens/Settings/SettingControls/StringControl.svelte";
|
||||
import NumberControl from "./SettingControls/NumberControl.svelte";
|
||||
import { tr } from "lib/Stores";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
@@ -53,8 +54,8 @@
|
||||
/>
|
||||
{:else}
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{displayText}</div>
|
||||
<div class="text-xs text-gray-500">{description}</div>
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{$tr(description)}</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -22,3 +22,5 @@ export const homeLayoutFileStore = writable([] as any);
|
||||
export const bookmarksStore = writable([] as any);
|
||||
|
||||
export const searchHistoryStore = writable([] as any);
|
||||
|
||||
export const tr = writable((s: string) => s as any);
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { InvidiousApi } from "lib/Api/InvidiousApi";
|
||||
import { invidiousVideoApiStore, playletStateStore } from "lib/Stores";
|
||||
import { invidiousVideoApiStore, playletStateStore, tr } from "lib/Stores";
|
||||
import VideoCell from "./VideoCell.svelte";
|
||||
import PlaylistCell from "./PlaylistCell.svelte";
|
||||
import ChannelCell from "./ChannelCell.svelte";
|
||||
@@ -263,7 +263,7 @@
|
||||
-->
|
||||
{#if feedLoadState !== FeedLoadState.Loaded || videos.length !== 0}
|
||||
<div class="text-lg font-semibold ml-4">
|
||||
{feed.title}
|
||||
{$tr(feed.title)}
|
||||
</div>
|
||||
<div
|
||||
class="carousel carousel-center rounded-box w-full space-x-4"
|
||||
|
||||
Reference in new issue
Block a user