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:
Brahim Hadricheandgithub-action linter authored and GitHub committed 2024-03-22 17:43:03 -04:00
1 parent 019fde1e67
commit 42dadec020
54 files changed
+538 -151

No files matched your search

+2
View File
@@ -572,6 +572,8 @@ components:
type: string
friendly_name:
type: string
current_locale:
type: string
invidious:
type: object
properties:
@@ -3,6 +3,7 @@ import "pkg:/components/VideoFeed/FeedLoadState.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/Logging.bs"
function LoadChannel(invidiousNode as object) as void
@@ -39,8 +40,8 @@ function OnChannelContentTaskResult(output as object) as void
error = ErrorUtils.Format(error)
LogError(error)
authorId = output.task.input.content.authorId
message = `Failed to load channel ${authorId}\n${error}`
DialogUtils.ShowDialog(message, "Channel load fail", true)
message = Tr(Locale.Dialogs.FailedToLoadChannel).Replace("%1", authorId) + `\n${error}`
DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.ChannelLoadError), true)
return
end if
end function
@@ -3,6 +3,7 @@ import "pkg:/components/VideoFeed/FeedLoadState.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/Logging.bs"
function LoadPlaylistPage(invidiousNode as object) as void
@@ -48,8 +49,8 @@ function OnPlaylistContentTaskResult(output as object) as void
error = ErrorUtils.Format(error)
LogError(error)
playlistId = output.task.input.content.playlistId
message = `Failed to load playlist ${playlistId}\n${error}`
DialogUtils.ShowDialog(message, "Playlist load fail", true)
message = Tr(Locale.Dialogs.FailedToLoadPlaylist).Replace("%1", playlistId) + `\n${error}`
DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.PlaylistLoadError), true)
return
end if
end function
@@ -42,7 +42,7 @@
<Preferences id="Preferences" />
<BookmarksService id="BookmarksService" />
<SearchHistory id="SearchHistory" />
<Profiles id="Profiles" />
<ProfilesService id="ProfilesService" />
<Invidious id="Invidious" />
<PlayletWebServer id="WebServer" port="8888" />
<DialServer id="DialServer" />
+3 -3
View File
@@ -70,14 +70,14 @@
<SearchHistory id="SearchHistory"
preferences="bind:../Preferences" />
<Profiles id="Profiles"
<ProfilesService id="ProfilesService"
invidious="bind:../Invidious" />
<Invidious id="Invidious"
webServer="bind:../WebServer"
applicationInfo="bind:../ApplicationInfo"
preferences="bind:../Preferences"
profiles="bind:../Profiles" />
profilesService="bind:../ProfilesService" />
<!-- Tasks -->
<PlayletWebServer id="WebServer"
@@ -85,7 +85,7 @@
appController="bind:/AppController"
applicationInfo="bind:../ApplicationInfo"
invidious="bind:../Invidious"
profiles="bind:../Profiles"
profilesService="bind:../ProfilesService"
preferences="bind:../Preferences"
videoQueue="bind:../VideoQueue"
bookmarksService="bind:../BookmarksService"
@@ -24,20 +24,20 @@ function InitializeBindings()
"SearchHistory": {
"preferences": "../Preferences"
},
"Profiles": {
"ProfilesService": {
"invidious": "../Invidious"
},
"Invidious": {
"webServer": "../WebServer",
"applicationInfo": "../ApplicationInfo",
"preferences": "../Preferences",
"profiles": "../Profiles"
"profilesService": "../ProfilesService"
},
"WebServer": {
"appController": "/AppController",
"applicationInfo": "../ApplicationInfo",
"invidious": "../Invidious",
"profiles": "../Profiles",
"profilesService": "../ProfilesService",
"preferences": "../Preferences",
"videoQueue": "../VideoQueue",
"bookmarksService": "../BookmarksService",
@@ -20,10 +20,10 @@ function Init()
m.top.observeField("width", FuncName(onWidthChanged))
m.top.observeField("padding", FuncName(onPaddingChanged))
profiles = m.top.getScene().findNode("Profiles")
if profiles <> invalid
m.profiles = profiles
profiles.observeField("currentProfile", FuncName(OnCurrentProfile))
profilesService = m.top.getScene().findNode("ProfilesService")
if profilesService <> invalid
m.profilesService = profilesService
profilesService.observeField("currentProfile", FuncName(OnCurrentProfile))
OnCurrentProfile()
end if
end function
@@ -91,7 +91,7 @@ function onPaddingChanged()
end function
function OnCurrentProfile() as void
currentProfile = m.profiles.currentProfile
currentProfile = m.profilesService.currentProfile
if currentProfile = invalid
m.circlePoster.visible = false
m.buttonIcon.visible = true
@@ -21,8 +21,8 @@ function OnNodeReady()
SetNavigation(m.closeButton, "up", m.logoutButton)
SetNavigation(m.logoutButton, "up", m.activateButton)
DisposableObserveFieldScoped(m.profiles, "currentProfile", FuncName(OnCunrrentProfileChanged))
DisposableObserveFieldScoped(m.profiles, "onProfileLogout", FuncName(OnProfileLogout))
DisposableObserveFieldScoped(m.profilesService, "currentProfile", FuncName(OnCunrrentProfileChanged))
DisposableObserveFieldScoped(m.profilesService, "onProfileLogout", FuncName(OnProfileLogout))
end function
function OnContentSet() as void
@@ -81,13 +81,13 @@ function Activate() as void
return
end if
profile = m.profiles.content.getChild(0).findNode(content.id)
profile = m.profilesService.content.getChild(0).findNode(content.id)
if profile = invalid
return
end if
m.top.content = invalid
m.profiles@.SetCurrentProfile(profile)
m.profilesService@.SetCurrentProfile(profile)
Close()
end function
@@ -98,7 +98,7 @@ function Logout() as void
end if
m.top.content = invalid
m.profiles@.LogoutWithProfile(content)
m.profilesService@.LogoutWithProfile(content)
Close()
end function
@@ -127,7 +127,7 @@ function OnProfileLogout() as void
return
end if
profile = m.profiles.content.getChild(0).findNode(content.id)
profile = m.profilesService.content.getChild(0).findNode(content.id)
if profile = invalid
Close()
end if
@@ -9,7 +9,7 @@
<field id="crownVisible" type="boolean" alias="CrownPoster.visible" />
<field id="appController" type="node" bind="/AppController" />
<field id="profiles" type="node" bind="/Profiles" />
<field id="profilesService" type="node" bind="/ProfilesService" />
</interface>
<children>
<Rectangle
@@ -13,9 +13,9 @@ function OnNodeReady()
SetNavigation(invalid, "back", m.navBar)
SetNavigation(invalid, "left", m.navBar)
m.profileRowList.content = m.profiles.content
m.profileRowList.content = m.profilesService.content
m.profileRowList.observeFieldScoped("rowItemSelected", FuncName(OnRowItemSelected))
m.profiles.observeFieldScoped("currentProfile", FuncName(OnCurrentProfileChanged))
m.profilesService.observeFieldScoped("currentProfile", FuncName(OnCurrentProfileChanged))
end function
function OnFocusChange() as void
@@ -47,7 +47,7 @@ function OnRowItemSelected() as void
end function
function OnCurrentProfileChanged() as void
currentProfile = m.profiles.currentProfile
currentProfile = m.profilesService.currentProfile
if currentProfile = invalid
return
end if
@@ -1,7 +1,7 @@
<component name="ProfileScreen" extends="Group" includes="AutoBind,Focus">
<interface>
<field id="navBar" type="node" bind="/NavBar" />
<field id="profiles" type="node" bind="/Profiles" />
<field id="profilesService" type="node" bind="/ProfilesService" />
<field id="appController" type="node" bind="/AppController" />
</interface>
@@ -241,7 +241,7 @@ function OnSearchContentReady() as void
m.rowlist.UnobserveFieldScoped("someContentReady")
if not m.rowlist.someContentReady
DialogUtils.ShowDialog("We didn't find any results for your search. Please try again with a different query or different filters.", "No results found")
DialogUtils.ShowDialog(Tr(Locale.Dialogs.NoResultsFoundMessage), Tr(Locale.Dialogs.NoResultsFound))
m.rowlist.feeds = invalid
m.rowlist.focusable = false
HideLoadingScreen()
@@ -121,8 +121,8 @@ function OnInvidiousPublicInstancesTaskResults(output as object) as void
error = ErrorUtils.Format(error)
LogError(output.error)
message = `Failed to load Invidious public instances\n${error}`
DialogUtils.ShowDialog(message, "Invidious public instances load error", true)
message = Tr(Locale.Dialogs.FailedToLoadInvidiousPublicInstances) + `\n${error}`
DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.InvidiousPublicInstancesLoadError), true)
m.failedLabel.visible = true
m.refreshButton.visible = true
@@ -3,7 +3,7 @@
<field id="applicationInfo" type="node" />
<field id="preferences" type="node" />
<field id="webServer" type="node" />
<field id="profiles" type="node" />
<field id="profilesService" type="node" />
<field id="authToken" type="assocarray" onChange="OnAuthTokenChange" />
<field id="apiDefinitions" type="assocarray" />
@@ -510,7 +510,7 @@ namespace Invidious
end if
LogInfo("Deleting Invidious token...")
m.invidiousNode.profiles@.LogoutWithAccessToken(authToken.token)
m.invidiousNode.profilesService@.LogoutWithAccessToken(authToken.token)
end function
function VerifyTokenScope(token as string) as boolean
@@ -102,17 +102,17 @@ class LoungeApi
response = request.Await()
if not response.IsSuccess()
error = `Failed to get screen id. Please restart playlet to use the cast function.\n${response.ErrorMessage()}`
error = Tr(Locale.Dialogs.LoungeFailedToGetScreenId) + `\n${response.ErrorMessage()}`
LogError(error)
DialogUtils.ShowDialog(error, "Lounge service setup error")
DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.LoungeServiceSetupError))
return invalid
end if
id = response.Text()
if not IsString(id)
error = `Failed to get screen id. Please restart playlet to use the cast function.\nNot a valid screen id: ${id}`
error = Tr(Locale.Dialogs.LoungeFailedToGetScreenId) + `\n` = Tr(Locale.Dialogs.LoungeNotAValidScreenId).Replace("%1", `${id}`)
LogError(error)
DialogUtils.ShowDialog(error, "Lounge service setup error")
DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.LoungeServiceSetupError))
return invalid
end if
@@ -132,18 +132,18 @@ class LoungeApi
response = request.Await()
if not response.IsSuccess()
error = `Failed to get lounge token. Please restart playlet to use the cast function.\n${response.ErrorMessage()}`
error = Tr(Locale.Dialogs.LoungeFailedToGetLoungeToken) + `\n${response.ErrorMessage()}`
LogError(error)
DialogUtils.ShowDialog(error, "Lounge service setup error")
DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.LoungeServiceSetupError))
return invalid
end if
json = response.Json()
screens = json.screens
if not IsArray(screens) or screens.Count() <> 1
error = `Failed to get lounge token. Please restart playlet to use the cast function.\nInvalid response: ${json}`
error = Tr(Locale.Dialogs.LoungeFailedToGetLoungeToken) + `\n` + Tr(Locale.Dialogs.LoungeInvalidResponse).Replace("%1", `${json}`)
LogError(error)
DialogUtils.ShowDialog(error, "Lounge service setup error")
DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.LoungeServiceSetupError))
return invalid
end if
@@ -178,9 +178,9 @@ class LoungeApi
response = request.Await()
if not response.IsSuccess()
error = `Failed to get session data. Please restart playlet to use the cast function.\n${response.ErrorMessage()}`
error = Tr(Locale.Dialogs.LoungeFailedToGetSessionData) + `\n${response.ErrorMessage()}`
LogError(error)
DialogUtils.ShowDialog(error, "Lounge service setup error")
DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.LoungeServiceSetupError))
return false
end if
@@ -73,7 +73,7 @@ function LoadProfilesFromRegistry()
if profileNodes.Count() > 0
AsyncTask.Start(Tasks.ProfilesVerifyTokensTask, {
profiles: m.top
profilesService: m.top
invidious: m.invidious
profileNodes: profileNodes
})
@@ -220,7 +220,6 @@ function LogoutWithProfile(profile as object) as void
m.top.onProfileLogout = true
AsyncTask.Start(Tasks.ProfilesInvidiousUnregisterTokenTask, {
profiles: m.top
invidious: m.invidious
profileNodes: [profile]
})
@@ -1,4 +1,4 @@
<component name="Profiles" extends="Node" includes="AutoBind">
<component name="ProfilesService" extends="Node" includes="AutoBind">
<interface>
<!--
The version of the profiles. This is used to determine if the
@@ -2,7 +2,7 @@ import "pkg:/components/Services/Invidious/InvidiousService.bs"
@asynctask
function ProfilesVerifyTokensTask(input as object) as object
profilesNode = input.profiles
profilesNode = input.profilesService
invidiousNode = input.invidious
profileContentNodes = input.profileNodes
@@ -27,12 +27,8 @@ function ProfilesVerifyTokensTask(input as object) as object
end for
profileNames = profileNames.join(", ")
message = `It looks like you are logged in to Invidious, but do not have the required permissions.
For that reason, we have logged you out from the following profiles: ${profileNames}
Please log in again.
This can happen when Playlet is updated with new features.
We apologize for the inconvenience.`
DialogUtils.ShowDialog(message, "User logged out")
message = Tr(Locale.Dialogs.UserLoggedOutMessage).Replace("\n", `\n`).Replace("%1", profileNames)
DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.UserLoggedOut))
return invalid
end function
@@ -190,5 +190,5 @@ function HandleFeedLoadErrorDialog(error as object, rowList as object) as void
if rowList.hasField("dispose") and rowList.dispose
return
end if
DialogUtils.ShowDialog(error, "Failed to load feed", true)
DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.FailedToLoadFeed), true)
end function
@@ -9,7 +9,7 @@ namespace Http
super()
task = server.task
m.profilesNode = task.profiles
m.profilesNode = task.profilesService
m.invidiousNode = task.invidious
m.invidiousService = new Invidious.InvidiousService(m.invidiousNode)
end function
@@ -5,7 +5,7 @@ namespace Http
function new(server as object)
super()
m.profilesNode = server.task.profiles
m.profilesNode = server.task.profilesService
m.profilesContent = m.profilesNode.content.getChild(0)
end function
@@ -11,7 +11,7 @@ namespace Http
m.applicationInfoNode = task.applicationInfo
m.invidiousNode = task.invidious
m.preferencesNode = task.preferences
m.profilesNode = task.profiles
m.profilesNode = task.profilesService
end function
@get("/api/state")
@@ -54,6 +54,7 @@ function SetupRoutes(server as object)
etags = new Http.EtagUtils()
server.UseRouter(new Http.HttpStaticFilesRouter("/", "libpkg:/www", etags, { staticFiles: true }))
server.UseRouter(new Http.HttpStaticFilesRouter("/config", "libpkg:/config", etags, { staticFiles: true }))
server.UseRouter(new Http.HttpStaticFilesRouter("/locale", "libpkg:/locale", etags, { staticFiles: true }))
server.UseRouter(new Http.HttpStaticFilesRouter("/logs", "cachefs:/logs", etags, { fsCheck: true }))
#if DEBUG
server.UseRouter(new Http.RegistryRouter())
@@ -3,7 +3,7 @@
<field id="appController" type="node" />
<field id="preferences" type="node" />
<field id="invidious" type="node" />
<field id="profiles" type="node" />
<field id="profilesService" type="node" />
<field id="applicationInfo" type="node" />
<field id="videoQueue" type="node" />
<field id="bookmarksService" type="node" />
+1
View File
@@ -26,6 +26,7 @@
png: "image/png",
qt: "video/quicktime",
svg: "image/svg+xml",
ts: "application/xml",
txt: "text/plain",
xsl: "application/xml",
xslt: "application/xslt+xml",
+3 -3
View File
@@ -42,7 +42,7 @@
{
displayText: "Instance",
key: "invidious.instance",
description: 'Invidious instance to use. Example: https://example.com. Find more instances at <a class="link" href="https://api.invidious.io" target="_blank" rel="noopener noreferrer">https://api.invidious.io</a>',
description: "Invidious instance to use. Example: https://example.com. Find more instances at $INVIDIOUS_PUBLIC_INSTANCES",
type: "string",
visibility: "web",
},
@@ -110,14 +110,14 @@
defaultValue: true,
},
{
displayText: "Clear Search History",
displayText: "Clear search history",
key: "search_history.clear_search_history",
description: "Clear search history from Playlet. This affects the search suggestions. This does not affect the watch history on Invidious.",
visibility: "web",
svelteComponent: "ClearSearchHistoryControl",
},
{
displayText: "Clear Search History",
displayText: "Clear search history",
key: "search_history.clear_search_history",
description: "Clear search history from Playlet. This affects the search suggestions. This does not affect the watch history on Invidious.",
visibility: "tv",
+126 -2
View File
@@ -180,6 +180,74 @@
<source>Last video added</source>
<translation>Last video added</translation>
</message>
<message>
<source>Channel load error</source>
<translation>Channel load error</translation>
</message>
<message>
<source>Failed to load channel %1</source>
<translation>Failed to load channel %1</translation>
</message>
<message>
<source>Playlist load error</source>
<translation>Playlist load error</translation>
</message>
<message>
<source>Failed to load playlist %1</source>
<translation>Failed to load playlist %1</translation>
</message>
<message>
<source>No results found</source>
<translation>No results found</translation>
</message>
<message>
<source>We didn't find any results for your search. Please try again with a different query or different filters.</source>
<translation>We didn't find any results for your search. Please try again with a different query or different filters.</translation>
</message>
<message>
<source>Invidious public instances load error</source>
<translation>Invidious public instances load error</translation>
</message>
<message>
<source>Failed to load Invidious public instances</source>
<translation>Failed to load Invidious public instances</translation>
</message>
<message>
<source>Failed to load feed</source>
<translation>Failed to load feed</translation>
</message>
<message>
<source>User logged out</source>
<translation>User logged out</translation>
</message>
<message>
<source>It looks like you are logged in to Invidious, but do not have the required permissions.\nFor that reason, we have logged you out from the following profiles: %1\nPlease log in again.\nThis can happen when Playlet is updated with new features.\nWe apologize for the inconvenience.</source>
<translation>It looks like you are logged in to Invidious, but do not have the required permissions.\nFor that reason, we have logged you out from the following profiles: %1\nPlease log in again.\nThis can happen when Playlet is updated with new features.\nWe apologize for the inconvenience.</translation>
</message>
<message>
<source>Lounge service setup error</source>
<translation>Lounge service setup error</translation>
</message>
<message>
<source>Failed to get screen ID. Please restart Playlet to use the cast function.</source>
<translation>Failed to get screen ID. Please restart Playlet to use the cast function.</translation>
</message>
<message>
<source>Not a valid screen id: %1</source>
<translation>Not a valid screen id: %1</translation>
</message>
<message>
<source>Failed to get lounge token. Please restart Playlet to use the cast function.</source>
<translation>Failed to get lounge token. Please restart Playlet to use the cast function.</translation>
</message>
<message>
<source>Invalid response: %1</source>
<translation>Invalid response: %1</translation>
</message>
<message>
<source>Failed to get session data. Please restart Playlet to use the cast function.</source>
<translation>Failed to get session data. Please restart Playlet to use the cast function.</translation>
</message>
<message>
<source>Invidious custom instance</source>
<translation>Invidious custom instance</translation>
@@ -741,8 +809,8 @@
<translation>Enable search history</translation>
</message>
<message>
<source>Clear Search History</source>
<translation>Clear Search History</translation>
<source>Clear search history</source>
<translation>Clear search history</translation>
</message>
<message>
<source>Clear search history from Playlet. This affects the search suggestions. This does not affect the watch history on Invidious.</source>
@@ -924,5 +992,61 @@
<source>Queue</source>
<translation>Queue</translation>
</message>
<message>
<source>Load more</source>
<translation>Load more</translation>
</message>
<message>
<source>No Bookmarks</source>
<translation>No Bookmarks</translation>
</message>
<message>
<source>To add bookmarks, select a video, playlist or channel, and add a bookmark.</source>
<translation>To add bookmarks, select a video, playlist or channel, and add a bookmark.</translation>
</message>
<message>
<source>Invidious instance to use. Example: https://example.com. Find more instances at $INVIDIOUS_PUBLIC_INSTANCES</source>
<translation>Invidious instance to use. Example: https://example.com. Find more instances at $INVIDIOUS_PUBLIC_INSTANCES</translation>
</message>
<message>
<source>Thank you for using Playlet.</source>
<translation>Thank you for using Playlet.</translation>
</message>
<message>
<source>You have feedback? Let us know by %IssueStart%creating an issue on Github%IssueEnd% or by %EmailStart%sending an email%EmailEnd%.</source>
<translation>You have feedback? Let us know by %IssueStart%creating an issue on Github%IssueEnd% or by %EmailStart%sending an email%EmailEnd%.</translation>
</message>
<message>
<source>Latest (default)</source>
<translation>Latest (default)</translation>
</message>
<message>
<source>Apply</source>
<translation>Apply</translation>
</message>
<message>
<source>Are you sure you want to change the Playlet Library version to %1?</source>
<translation>Are you sure you want to change the Playlet Library version to %1?</translation>
</message>
<message>
<source>This will restart Playlet.</source>
<translation>This will restart Playlet.</translation>
</message>
<message>
<source>Playlet Library version changed. Playlet will now restart.</source>
<translation>Playlet Library version changed. Playlet will now restart.</translation>
</message>
<message>
<source>Error with login, please refresh the page.</source>
<translation>Error with login, please refresh the page.</translation>
</message>
<message>
<source>Profiles</source>
<translation>Profiles</translation>
</message>
<message>
<source>Drop a YouTube link here</source>
<translation>Drop a YouTube link here</translation>
</message>
</context>
</TS>
+125 -1
View File
@@ -177,6 +177,74 @@
<source>Last video added</source>
<translation>Dernière vidéo ajoutée</translation>
</message>
<message>
<source>Channel load error</source>
<translation>Erreur de chargement de la chaîne</translation>
</message>
<message>
<source>Failed to load channel %1</source>
<translation>Échec du chargement de la chaîne %1</translation>
</message>
<message>
<source>Playlist load error</source>
<translation>Erreur de chargement de la playlist</translation>
</message>
<message>
<source>Failed to load playlist %1</source>
<translation>Échec du chargement de la playlist %1</translation>
</message>
<message>
<source>No results found</source>
<translation>Aucun résultat trouvé</translation>
</message>
<message>
<source>We didn't find any results for your search. Please try again with a different query or different filters.</source>
<translation>Nous n'avons trouvé aucun résultat pour votre recherche. Veuillez réessayer avec une requête différente ou des filtres différents.</translation>
</message>
<message>
<source>Invidious public instances load error</source>
<translation>Erreur de chargement des instances publiques Invidious</translation>
</message>
<message>
<source>Failed to load Invidious public instances</source>
<translation>Échec du chargement des instances publiques Invidious</translation>
</message>
<message>
<source>Failed to load feed</source>
<translation>Échec du chargement du flux</translation>
</message>
<message>
<source>User logged out</source>
<translation>Utilisateur déconnecté</translation>
</message>
<message>
<source>It looks like you are logged in to Invidious, but do not have the required permissions.\nFor that reason, we have logged you out from the following profiles: %1\nPlease log in again.\nThis can happen when Playlet is updated with new features.\nWe apologize for the inconvenience.</source>
<translation>Il semble que vous soyez connecté à Invidious, mais n'avez pas les permissions requises.\nPour cette raison, nous vous avons déconnecté des profils suivants : %1\nVeuillez vous reconnecter.\nCela peut se produire lorsque Playlet est mis à jour avec de nouvelles fonctionnalités.\nNous nous excusons pour la gêne occasionnée.</translation>
</message>
<message>
<source>Lounge service setup error</source>
<translation>Erreur de configuration du service Lounge</translation>
</message>
<message>
<source>Failed to get screen ID. Please restart Playlet to use the cast function.</source>
<translation>Impossible d'obtenir l'identifiant de l'écran. Veuillez redémarrer Playlet pour utiliser la fonction de diffusion.</translation>
</message>
<message>
<source>Not a valid screen id: %1</source>
<translation>Identifiant d'écran non valide : %1</translation>
</message>
<message>
<source>Failed to get lounge token. Please restart Playlet to use the cast function.</source>
<translation>Échec de l'obtention du jeton Lounge. Veuillez redémarrer Playlet pour utiliser la fonction de diffusion.</translation>
</message>
<message>
<source>Invalid response: %1</source>
<translation>Réponse non valide : %1</translation>
</message>
<message>
<source>Failed to get session data. Please restart Playlet to use the cast function.</source>
<translation>Échec de l'obtention des données de session. Veuillez redémarrer Playlet pour utiliser la fonction de diffusion.</translation>
</message>
<message>
<source>Invidious custom instance</source>
<translation>Instance personnalisée d'Invidious</translation>
@@ -738,7 +806,7 @@
<translation>Activer l'historique de recherche</translation>
</message>
<message>
<source>Clear Search History</source>
<source>Clear search history</source>
<translation>Effacer l'historique de recherche</translation>
</message>
<message>
@@ -922,5 +990,61 @@
<source>Queue</source>
<translation>File d'attente</translation>
</message>
<message>
<source>Load more</source>
<translation>Charger plus</translation>
</message>
<message>
<source>No Bookmarks</source>
<translation>Aucun favori</translation>
</message>
<message>
<source>To add bookmarks, select a video, playlist or channel, and add a bookmark.</source>
<translation>Pour ajouter des favoris, sélectionnez une vidéo, une playlist ou une chaîne, et ajoutez un favori.</translation>
</message>
<message>
<source>Invidious instance to use. Example: https://example.com. Find more instances at $INVIDIOUS_PUBLIC_INSTANCES</source>
<translation>Instance Invidious à utiliser. Exemple : https://example.com. Trouvez plus d'instances sur $INVIDIOUS_PUBLIC_INSTANCES</translation>
</message>
<message>
<source>Thank you for using Playlet.</source>
<translation>Merci d'utiliser Playlet.</translation>
</message>
<message>
<source>You have feedback? Let us know by %IssueStart%creating an issue on Github%IssueEnd% or by %EmailStart%sending an email%EmailEnd%.</source>
<translation>Vous avez des commentaires? Faites-nous savoir en %IssueStart%créant un "Issue" sur Github%IssueEnd% ou en %EmailStart%envoyant un email%EmailEnd%.</translation>
</message>
<message>
<source>Latest (default)</source>
<translation>La plus récente (par défaut)</translation>
</message>
<message>
<source>Apply</source>
<translation>Appliquer</translation>
</message>
<message>
<source>Are you sure you want to change the Playlet Library version to %1?</source>
<translation>Êtes-vous sûr de vouloir changer la version de Playlet Lib en %1 ?</translation>
</message>
<message>
<source>This will restart Playlet.</source>
<translation>Cela redémarrera Playlet.</translation>
</message>
<message>
<source>Playlet Library version changed. Playlet will now restart.</source>
<translation>La version de Playlet Lib a été modifiée. Playlet va maintenant redémarrer.</translation>
</message>
<message>
<source>Error with login, please refresh the page.</source>
<translation>Erreur de connexion, veuillez rafraîchir la page.</translation>
</message>
<message>
<source>Profiles</source>
<translation>Profils</translation>
</message>
<message>
<source>Drop a YouTube link here</source>
<translation>Déposez un lien YouTube ici</translation>
</message>
</context>
</TS>
@@ -79,6 +79,7 @@ class ApplicationInfo
internet_status: m.roDeviceInfo.GetInternetStatus()
user_country_code: m.roDeviceInfo.GetUserCountryCode()
friendly_name: m.roDeviceInfo.GetFriendlyName()
current_locale: m.roDeviceInfo.GetCurrentLocale()
}
end if
return m.deviceInfo
+38 -1
View File
@@ -65,6 +65,23 @@ namespace Locale
Oldest = "Oldest"
DateAdded = "Date added (newest)"
LastVideoAdded = "Last video added"
ChannelLoadError = "Channel load error"
FailedToLoadChannel = "Failed to load channel %1"
PlaylistLoadError = "Playlist load error"
FailedToLoadPlaylist = "Failed to load playlist %1"
NoResultsFound = "No results found"
NoResultsFoundMessage = "We didn't find any results for your search. Please try again with a different query or different filters."
InvidiousPublicInstancesLoadError = "Invidious public instances load error"
FailedToLoadInvidiousPublicInstances = "Failed to load Invidious public instances"
FailedToLoadFeed = "Failed to load feed"
UserLoggedOut = "User logged out"
UserLoggedOutMessage = "It looks like you are logged in to Invidious, but do not have the required permissions.\nFor that reason, we have logged you out from the following profiles: %1\nPlease log in again.\nThis can happen when Playlet is updated with new features.\nWe apologize for the inconvenience."
LoungeServiceSetupError = "Lounge service setup error"
LoungeFailedToGetScreenId = "Failed to get screen ID. Please restart Playlet to use the cast function."
LoungeNotAValidScreenId = "Not a valid screen id: %1"
LoungeFailedToGetLoungeToken = "Failed to get lounge token. Please restart Playlet to use the cast function."
LoungeInvalidResponse = "Invalid response: %1"
LoungeFailedToGetSessionData = "Failed to get session data. Please restart Playlet to use the cast function."
end enum
@locale
@@ -247,7 +264,7 @@ namespace Locale
SearchHistory = "Search History"
SearchHistoryPreferences = "Search history preferences"
EnableSearchHistory = "Enable search history"
ClearSearchHistory = "Clear Search History"
ClearSearchHistory = "Clear search history"
ClearSearchHistoryDescription = "Clear search history from Playlet. This affects the search suggestions. This does not affect the watch history on Invidious."
SearchHistoryCleared = "Search history cleared."
@@ -321,4 +338,24 @@ namespace Locale
enum VideoQueue
Queue = "Queue"
end enum
' Translations specific to the web app
@locale
enum WebApp
LoadMore = "Load more"
NoBookmarks = "No Bookmarks"
ToAddBookmarksInstructions = "To add bookmarks, select a video, playlist or channel, and add a bookmark."
InstanceDescriptionWeb = "Invidious instance to use. Example: https://example.com. Find more instances at $INVIDIOUS_PUBLIC_INSTANCES"
ThankYou = "Thank you for using Playlet."
FeedbackLinks = "You have feedback? Let us know by %IssueStart%creating an issue on Github%IssueEnd% or by %EmailStart%sending an email%EmailEnd%."
PlayletLibVersionLatestDefault = "Latest (default)"
Apply = "Apply"
PlayletLibVersionChangeDialog1 = "Are you sure you want to change the Playlet Library version to %1?"
PlayletLibVersionChangeDialog2 = "This will restart Playlet."
PlayletLibVersionChangeConfirm = "Playlet Library version changed. Playlet will now restart."
ErrorWithLogin = "Error with login, please refresh the page."
Profiles = "Profiles"
DropYouTubeLinkHere = "Drop a YouTube link here"
end enum
end namespace
+25 -1
View File
@@ -1,8 +1,32 @@
' TODO:P2 Translations left:
' - Context menu
' - Search filters
' - Web app
' - Loading messages
' Web app:
' - Video publish text
' - Video video count
' - Video live/upcoming/premiere indicator
' - Playlist updated time
' - Playlist video count
' - Channel sub count
' - Video dialog options
' - Play on
' - Queue on
' - Open in Invidious
' - Cancel
' - Channel dialog options
' - Open on
' - Open in Invidious
' - Cancel
' - Playlist dialog options
' - Play on
' - Queue on
' - Open on
' - Open in Invidious
' - Cancel
import "pkg:/source/utils/MathUtils.bs"
+2
View File
@@ -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) => {
+37
View File
@@ -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);
}
}
+5
View File
@@ -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();
+7 -7
View File
@@ -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>
+3 -8
View File
@@ -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}
+7 -7
View File
@@ -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}
+14 -12
View File
@@ -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>
@@ -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>
@@ -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}
+2
View File
@@ -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"
@@ -196,6 +196,16 @@ export class LocaleValidationPlugin implements CompilerPlugin {
severity: DiagnosticSeverity.Error,
code: 'LOCALE_MISSING_TRANSLATIONS',
}]);
const xml = missingLocaleValues.reduce((acc, value) => {
acc += `<message>
<source>${value}</source>
<translation>${value}</translation>
</message>\n`;
return acc;
}, '');
program.logger.error(`Add the following to en_US/translations.ts:\n${xml}`);
}
}