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 type: string
friendly_name: friendly_name:
type: string type: string
current_locale:
type: string
invidious: invidious:
type: object type: object
properties: properties:
@@ -3,6 +3,7 @@ import "pkg:/components/VideoFeed/FeedLoadState.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs" import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs" import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/ErrorUtils.bs" import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/Logging.bs" import "pkg:/source/utils/Logging.bs"
function LoadChannel(invidiousNode as object) as void function LoadChannel(invidiousNode as object) as void
@@ -39,8 +40,8 @@ function OnChannelContentTaskResult(output as object) as void
error = ErrorUtils.Format(error) error = ErrorUtils.Format(error)
LogError(error) LogError(error)
authorId = output.task.input.content.authorId authorId = output.task.input.content.authorId
message = `Failed to load channel ${authorId}\n${error}` message = Tr(Locale.Dialogs.FailedToLoadChannel).Replace("%1", authorId) + `\n${error}`
DialogUtils.ShowDialog(message, "Channel load fail", true) DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.ChannelLoadError), true)
return return
end if end if
end function end function
@@ -3,6 +3,7 @@ import "pkg:/components/VideoFeed/FeedLoadState.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs" import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs" import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/ErrorUtils.bs" import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/Logging.bs" import "pkg:/source/utils/Logging.bs"
function LoadPlaylistPage(invidiousNode as object) as void function LoadPlaylistPage(invidiousNode as object) as void
@@ -48,8 +49,8 @@ function OnPlaylistContentTaskResult(output as object) as void
error = ErrorUtils.Format(error) error = ErrorUtils.Format(error)
LogError(error) LogError(error)
playlistId = output.task.input.content.playlistId playlistId = output.task.input.content.playlistId
message = `Failed to load playlist ${playlistId}\n${error}` message = Tr(Locale.Dialogs.FailedToLoadPlaylist).Replace("%1", playlistId) + `\n${error}`
DialogUtils.ShowDialog(message, "Playlist load fail", true) DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.PlaylistLoadError), true)
return return
end if end if
end function end function
@@ -42,7 +42,7 @@
<Preferences id="Preferences" /> <Preferences id="Preferences" />
<BookmarksService id="BookmarksService" /> <BookmarksService id="BookmarksService" />
<SearchHistory id="SearchHistory" /> <SearchHistory id="SearchHistory" />
<Profiles id="Profiles" /> <ProfilesService id="ProfilesService" />
<Invidious id="Invidious" /> <Invidious id="Invidious" />
<PlayletWebServer id="WebServer" port="8888" /> <PlayletWebServer id="WebServer" port="8888" />
<DialServer id="DialServer" /> <DialServer id="DialServer" />
+3 -3
View File
@@ -70,14 +70,14 @@
<SearchHistory id="SearchHistory" <SearchHistory id="SearchHistory"
preferences="bind:../Preferences" /> preferences="bind:../Preferences" />
<Profiles id="Profiles" <ProfilesService id="ProfilesService"
invidious="bind:../Invidious" /> invidious="bind:../Invidious" />
<Invidious id="Invidious" <Invidious id="Invidious"
webServer="bind:../WebServer" webServer="bind:../WebServer"
applicationInfo="bind:../ApplicationInfo" applicationInfo="bind:../ApplicationInfo"
preferences="bind:../Preferences" preferences="bind:../Preferences"
profiles="bind:../Profiles" /> profilesService="bind:../ProfilesService" />
<!-- Tasks --> <!-- Tasks -->
<PlayletWebServer id="WebServer" <PlayletWebServer id="WebServer"
@@ -85,7 +85,7 @@
appController="bind:/AppController" appController="bind:/AppController"
applicationInfo="bind:../ApplicationInfo" applicationInfo="bind:../ApplicationInfo"
invidious="bind:../Invidious" invidious="bind:../Invidious"
profiles="bind:../Profiles" profilesService="bind:../ProfilesService"
preferences="bind:../Preferences" preferences="bind:../Preferences"
videoQueue="bind:../VideoQueue" videoQueue="bind:../VideoQueue"
bookmarksService="bind:../BookmarksService" bookmarksService="bind:../BookmarksService"
@@ -24,20 +24,20 @@ function InitializeBindings()
"SearchHistory": { "SearchHistory": {
"preferences": "../Preferences" "preferences": "../Preferences"
}, },
"Profiles": { "ProfilesService": {
"invidious": "../Invidious" "invidious": "../Invidious"
}, },
"Invidious": { "Invidious": {
"webServer": "../WebServer", "webServer": "../WebServer",
"applicationInfo": "../ApplicationInfo", "applicationInfo": "../ApplicationInfo",
"preferences": "../Preferences", "preferences": "../Preferences",
"profiles": "../Profiles" "profilesService": "../ProfilesService"
}, },
"WebServer": { "WebServer": {
"appController": "/AppController", "appController": "/AppController",
"applicationInfo": "../ApplicationInfo", "applicationInfo": "../ApplicationInfo",
"invidious": "../Invidious", "invidious": "../Invidious",
"profiles": "../Profiles", "profilesService": "../ProfilesService",
"preferences": "../Preferences", "preferences": "../Preferences",
"videoQueue": "../VideoQueue", "videoQueue": "../VideoQueue",
"bookmarksService": "../BookmarksService", "bookmarksService": "../BookmarksService",
@@ -20,10 +20,10 @@ function Init()
m.top.observeField("width", FuncName(onWidthChanged)) m.top.observeField("width", FuncName(onWidthChanged))
m.top.observeField("padding", FuncName(onPaddingChanged)) m.top.observeField("padding", FuncName(onPaddingChanged))
profiles = m.top.getScene().findNode("Profiles") profilesService = m.top.getScene().findNode("ProfilesService")
if profiles <> invalid if profilesService <> invalid
m.profiles = profiles m.profilesService = profilesService
profiles.observeField("currentProfile", FuncName(OnCurrentProfile)) profilesService.observeField("currentProfile", FuncName(OnCurrentProfile))
OnCurrentProfile() OnCurrentProfile()
end if end if
end function end function
@@ -91,7 +91,7 @@ function onPaddingChanged()
end function end function
function OnCurrentProfile() as void function OnCurrentProfile() as void
currentProfile = m.profiles.currentProfile currentProfile = m.profilesService.currentProfile
if currentProfile = invalid if currentProfile = invalid
m.circlePoster.visible = false m.circlePoster.visible = false
m.buttonIcon.visible = true m.buttonIcon.visible = true
@@ -21,8 +21,8 @@ function OnNodeReady()
SetNavigation(m.closeButton, "up", m.logoutButton) SetNavigation(m.closeButton, "up", m.logoutButton)
SetNavigation(m.logoutButton, "up", m.activateButton) SetNavigation(m.logoutButton, "up", m.activateButton)
DisposableObserveFieldScoped(m.profiles, "currentProfile", FuncName(OnCunrrentProfileChanged)) DisposableObserveFieldScoped(m.profilesService, "currentProfile", FuncName(OnCunrrentProfileChanged))
DisposableObserveFieldScoped(m.profiles, "onProfileLogout", FuncName(OnProfileLogout)) DisposableObserveFieldScoped(m.profilesService, "onProfileLogout", FuncName(OnProfileLogout))
end function end function
function OnContentSet() as void function OnContentSet() as void
@@ -81,13 +81,13 @@ function Activate() as void
return return
end if end if
profile = m.profiles.content.getChild(0).findNode(content.id) profile = m.profilesService.content.getChild(0).findNode(content.id)
if profile = invalid if profile = invalid
return return
end if end if
m.top.content = invalid m.top.content = invalid
m.profiles@.SetCurrentProfile(profile) m.profilesService@.SetCurrentProfile(profile)
Close() Close()
end function end function
@@ -98,7 +98,7 @@ function Logout() as void
end if end if
m.top.content = invalid m.top.content = invalid
m.profiles@.LogoutWithProfile(content) m.profilesService@.LogoutWithProfile(content)
Close() Close()
end function end function
@@ -127,7 +127,7 @@ function OnProfileLogout() as void
return return
end if end if
profile = m.profiles.content.getChild(0).findNode(content.id) profile = m.profilesService.content.getChild(0).findNode(content.id)
if profile = invalid if profile = invalid
Close() Close()
end if end if
@@ -9,7 +9,7 @@
<field id="crownVisible" type="boolean" alias="CrownPoster.visible" /> <field id="crownVisible" type="boolean" alias="CrownPoster.visible" />
<field id="appController" type="node" bind="/AppController" /> <field id="appController" type="node" bind="/AppController" />
<field id="profiles" type="node" bind="/Profiles" /> <field id="profilesService" type="node" bind="/ProfilesService" />
</interface> </interface>
<children> <children>
<Rectangle <Rectangle
@@ -13,9 +13,9 @@ function OnNodeReady()
SetNavigation(invalid, "back", m.navBar) SetNavigation(invalid, "back", m.navBar)
SetNavigation(invalid, "left", 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.profileRowList.observeFieldScoped("rowItemSelected", FuncName(OnRowItemSelected))
m.profiles.observeFieldScoped("currentProfile", FuncName(OnCurrentProfileChanged)) m.profilesService.observeFieldScoped("currentProfile", FuncName(OnCurrentProfileChanged))
end function end function
function OnFocusChange() as void function OnFocusChange() as void
@@ -47,7 +47,7 @@ function OnRowItemSelected() as void
end function end function
function OnCurrentProfileChanged() as void function OnCurrentProfileChanged() as void
currentProfile = m.profiles.currentProfile currentProfile = m.profilesService.currentProfile
if currentProfile = invalid if currentProfile = invalid
return return
end if end if
@@ -1,7 +1,7 @@
<component name="ProfileScreen" extends="Group" includes="AutoBind,Focus"> <component name="ProfileScreen" extends="Group" includes="AutoBind,Focus">
<interface> <interface>
<field id="navBar" type="node" bind="/NavBar" /> <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" /> <field id="appController" type="node" bind="/AppController" />
</interface> </interface>
@@ -241,7 +241,7 @@ function OnSearchContentReady() as void
m.rowlist.UnobserveFieldScoped("someContentReady") m.rowlist.UnobserveFieldScoped("someContentReady")
if not m.rowlist.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.feeds = invalid
m.rowlist.focusable = false m.rowlist.focusable = false
HideLoadingScreen() HideLoadingScreen()
@@ -121,8 +121,8 @@ function OnInvidiousPublicInstancesTaskResults(output as object) as void
error = ErrorUtils.Format(error) error = ErrorUtils.Format(error)
LogError(output.error) LogError(output.error)
message = `Failed to load Invidious public instances\n${error}` message = Tr(Locale.Dialogs.FailedToLoadInvidiousPublicInstances) + `\n${error}`
DialogUtils.ShowDialog(message, "Invidious public instances load error", true) DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.InvidiousPublicInstancesLoadError), true)
m.failedLabel.visible = true m.failedLabel.visible = true
m.refreshButton.visible = true m.refreshButton.visible = true
@@ -3,7 +3,7 @@
<field id="applicationInfo" type="node" /> <field id="applicationInfo" type="node" />
<field id="preferences" type="node" /> <field id="preferences" type="node" />
<field id="webServer" 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="authToken" type="assocarray" onChange="OnAuthTokenChange" />
<field id="apiDefinitions" type="assocarray" /> <field id="apiDefinitions" type="assocarray" />
@@ -510,7 +510,7 @@ namespace Invidious
end if end if
LogInfo("Deleting Invidious token...") LogInfo("Deleting Invidious token...")
m.invidiousNode.profiles@.LogoutWithAccessToken(authToken.token) m.invidiousNode.profilesService@.LogoutWithAccessToken(authToken.token)
end function end function
function VerifyTokenScope(token as string) as boolean function VerifyTokenScope(token as string) as boolean
@@ -102,17 +102,17 @@ class LoungeApi
response = request.Await() response = request.Await()
if not response.IsSuccess() 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) LogError(error)
DialogUtils.ShowDialog(error, "Lounge service setup error") DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.LoungeServiceSetupError))
return invalid return invalid
end if end if
id = response.Text() id = response.Text()
if not IsString(id) 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) LogError(error)
DialogUtils.ShowDialog(error, "Lounge service setup error") DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.LoungeServiceSetupError))
return invalid return invalid
end if end if
@@ -132,18 +132,18 @@ class LoungeApi
response = request.Await() response = request.Await()
if not response.IsSuccess() 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) LogError(error)
DialogUtils.ShowDialog(error, "Lounge service setup error") DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.LoungeServiceSetupError))
return invalid return invalid
end if end if
json = response.Json() json = response.Json()
screens = json.screens screens = json.screens
if not IsArray(screens) or screens.Count() <> 1 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) LogError(error)
DialogUtils.ShowDialog(error, "Lounge service setup error") DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.LoungeServiceSetupError))
return invalid return invalid
end if end if
@@ -178,9 +178,9 @@ class LoungeApi
response = request.Await() response = request.Await()
if not response.IsSuccess() 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) LogError(error)
DialogUtils.ShowDialog(error, "Lounge service setup error") DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.LoungeServiceSetupError))
return false return false
end if end if
@@ -73,7 +73,7 @@ function LoadProfilesFromRegistry()
if profileNodes.Count() > 0 if profileNodes.Count() > 0
AsyncTask.Start(Tasks.ProfilesVerifyTokensTask, { AsyncTask.Start(Tasks.ProfilesVerifyTokensTask, {
profiles: m.top profilesService: m.top
invidious: m.invidious invidious: m.invidious
profileNodes: profileNodes profileNodes: profileNodes
}) })
@@ -220,7 +220,6 @@ function LogoutWithProfile(profile as object) as void
m.top.onProfileLogout = true m.top.onProfileLogout = true
AsyncTask.Start(Tasks.ProfilesInvidiousUnregisterTokenTask, { AsyncTask.Start(Tasks.ProfilesInvidiousUnregisterTokenTask, {
profiles: m.top
invidious: m.invidious invidious: m.invidious
profileNodes: [profile] profileNodes: [profile]
}) })
@@ -1,4 +1,4 @@
<component name="Profiles" extends="Node" includes="AutoBind"> <component name="ProfilesService" extends="Node" includes="AutoBind">
<interface> <interface>
<!-- <!--
The version of the profiles. This is used to determine if the The version of the profiles. This is used to determine if the
@@ -2,7 +2,7 @@ import "pkg:/components/Services/Invidious/InvidiousService.bs"
@asynctask @asynctask
function ProfilesVerifyTokensTask(input as object) as object function ProfilesVerifyTokensTask(input as object) as object
profilesNode = input.profiles profilesNode = input.profilesService
invidiousNode = input.invidious invidiousNode = input.invidious
profileContentNodes = input.profileNodes profileContentNodes = input.profileNodes
@@ -27,12 +27,8 @@ function ProfilesVerifyTokensTask(input as object) as object
end for end for
profileNames = profileNames.join(", ") profileNames = profileNames.join(", ")
message = `It looks like you are logged in to Invidious, but do not have the required permissions. message = Tr(Locale.Dialogs.UserLoggedOutMessage).Replace("\n", `\n`).Replace("%1", profileNames)
For that reason, we have logged you out from the following profiles: ${profileNames} DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.UserLoggedOut))
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")
return invalid return invalid
end function end function
@@ -190,5 +190,5 @@ function HandleFeedLoadErrorDialog(error as object, rowList as object) as void
if rowList.hasField("dispose") and rowList.dispose if rowList.hasField("dispose") and rowList.dispose
return return
end if end if
DialogUtils.ShowDialog(error, "Failed to load feed", true) DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.FailedToLoadFeed), true)
end function end function
@@ -9,7 +9,7 @@ namespace Http
super() super()
task = server.task task = server.task
m.profilesNode = task.profiles m.profilesNode = task.profilesService
m.invidiousNode = task.invidious m.invidiousNode = task.invidious
m.invidiousService = new Invidious.InvidiousService(m.invidiousNode) m.invidiousService = new Invidious.InvidiousService(m.invidiousNode)
end function end function
@@ -5,7 +5,7 @@ namespace Http
function new(server as object) function new(server as object)
super() super()
m.profilesNode = server.task.profiles m.profilesNode = server.task.profilesService
m.profilesContent = m.profilesNode.content.getChild(0) m.profilesContent = m.profilesNode.content.getChild(0)
end function end function
@@ -11,7 +11,7 @@ namespace Http
m.applicationInfoNode = task.applicationInfo m.applicationInfoNode = task.applicationInfo
m.invidiousNode = task.invidious m.invidiousNode = task.invidious
m.preferencesNode = task.preferences m.preferencesNode = task.preferences
m.profilesNode = task.profiles m.profilesNode = task.profilesService
end function end function
@get("/api/state") @get("/api/state")
@@ -54,6 +54,7 @@ function SetupRoutes(server as object)
etags = new Http.EtagUtils() etags = new Http.EtagUtils()
server.UseRouter(new Http.HttpStaticFilesRouter("/", "libpkg:/www", etags, { staticFiles: true })) 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("/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 })) server.UseRouter(new Http.HttpStaticFilesRouter("/logs", "cachefs:/logs", etags, { fsCheck: true }))
#if DEBUG #if DEBUG
server.UseRouter(new Http.RegistryRouter()) server.UseRouter(new Http.RegistryRouter())
@@ -3,7 +3,7 @@
<field id="appController" type="node" /> <field id="appController" type="node" />
<field id="preferences" type="node" /> <field id="preferences" type="node" />
<field id="invidious" type="node" /> <field id="invidious" type="node" />
<field id="profiles" type="node" /> <field id="profilesService" type="node" />
<field id="applicationInfo" type="node" /> <field id="applicationInfo" type="node" />
<field id="videoQueue" type="node" /> <field id="videoQueue" type="node" />
<field id="bookmarksService" type="node" /> <field id="bookmarksService" type="node" />
+1
View File
@@ -26,6 +26,7 @@
png: "image/png", png: "image/png",
qt: "video/quicktime", qt: "video/quicktime",
svg: "image/svg+xml", svg: "image/svg+xml",
ts: "application/xml",
txt: "text/plain", txt: "text/plain",
xsl: "application/xml", xsl: "application/xml",
xslt: "application/xslt+xml", xslt: "application/xslt+xml",
+3 -3
View File
@@ -42,7 +42,7 @@
{ {
displayText: "Instance", displayText: "Instance",
key: "invidious.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", type: "string",
visibility: "web", visibility: "web",
}, },
@@ -110,14 +110,14 @@
defaultValue: true, defaultValue: true,
}, },
{ {
displayText: "Clear Search History", displayText: "Clear search history",
key: "search_history.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.", description: "Clear search history from Playlet. This affects the search suggestions. This does not affect the watch history on Invidious.",
visibility: "web", visibility: "web",
svelteComponent: "ClearSearchHistoryControl", svelteComponent: "ClearSearchHistoryControl",
}, },
{ {
displayText: "Clear Search History", displayText: "Clear search history",
key: "search_history.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.", description: "Clear search history from Playlet. This affects the search suggestions. This does not affect the watch history on Invidious.",
visibility: "tv", visibility: "tv",
+126 -2
View File
@@ -180,6 +180,74 @@
<source>Last video added</source> <source>Last video added</source>
<translation>Last video added</translation> <translation>Last video added</translation>
</message> </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> <message>
<source>Invidious custom instance</source> <source>Invidious custom instance</source>
<translation>Invidious custom instance</translation> <translation>Invidious custom instance</translation>
@@ -741,8 +809,8 @@
<translation>Enable search history</translation> <translation>Enable search history</translation>
</message> </message>
<message> <message>
<source>Clear Search History</source> <source>Clear search history</source>
<translation>Clear Search History</translation> <translation>Clear search history</translation>
</message> </message>
<message> <message>
<source>Clear search history from Playlet. This affects the search suggestions. This does not affect the watch history on Invidious.</source> <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> <source>Queue</source>
<translation>Queue</translation> <translation>Queue</translation>
</message> </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> </context>
</TS> </TS>
+125 -1
View File
@@ -177,6 +177,74 @@
<source>Last video added</source> <source>Last video added</source>
<translation>Dernière vidéo ajoutée</translation> <translation>Dernière vidéo ajoutée</translation>
</message> </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> <message>
<source>Invidious custom instance</source> <source>Invidious custom instance</source>
<translation>Instance personnalisée d'Invidious</translation> <translation>Instance personnalisée d'Invidious</translation>
@@ -738,7 +806,7 @@
<translation>Activer l'historique de recherche</translation> <translation>Activer l'historique de recherche</translation>
</message> </message>
<message> <message>
<source>Clear Search History</source> <source>Clear search history</source>
<translation>Effacer l'historique de recherche</translation> <translation>Effacer l'historique de recherche</translation>
</message> </message>
<message> <message>
@@ -922,5 +990,61 @@
<source>Queue</source> <source>Queue</source>
<translation>File d'attente</translation> <translation>File d'attente</translation>
</message> </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> </context>
</TS> </TS>
@@ -79,6 +79,7 @@ class ApplicationInfo
internet_status: m.roDeviceInfo.GetInternetStatus() internet_status: m.roDeviceInfo.GetInternetStatus()
user_country_code: m.roDeviceInfo.GetUserCountryCode() user_country_code: m.roDeviceInfo.GetUserCountryCode()
friendly_name: m.roDeviceInfo.GetFriendlyName() friendly_name: m.roDeviceInfo.GetFriendlyName()
current_locale: m.roDeviceInfo.GetCurrentLocale()
} }
end if end if
return m.deviceInfo return m.deviceInfo
+38 -1
View File
@@ -65,6 +65,23 @@ namespace Locale
Oldest = "Oldest" Oldest = "Oldest"
DateAdded = "Date added (newest)" DateAdded = "Date added (newest)"
LastVideoAdded = "Last video added" 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 end enum
@locale @locale
@@ -247,7 +264,7 @@ namespace Locale
SearchHistory = "Search History" SearchHistory = "Search History"
SearchHistoryPreferences = "Search history preferences" SearchHistoryPreferences = "Search history preferences"
EnableSearchHistory = "Enable search history" 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." ClearSearchHistoryDescription = "Clear search history from Playlet. This affects the search suggestions. This does not affect the watch history on Invidious."
SearchHistoryCleared = "Search history cleared." SearchHistoryCleared = "Search history cleared."
@@ -321,4 +338,24 @@ namespace Locale
enum VideoQueue enum VideoQueue
Queue = "Queue" Queue = "Queue"
end enum 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 end namespace
+25 -1
View File
@@ -1,8 +1,32 @@
' TODO:P2 Translations left: ' TODO:P2 Translations left:
' - Context menu ' - Context menu
' - Search filters ' - Search filters
' - Web app
' - Loading messages ' - 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" import "pkg:/source/utils/MathUtils.bs"
+2
View File
@@ -22,10 +22,12 @@
import LinkDragDrop from "lib/LinkDragDrop.svelte"; import LinkDragDrop from "lib/LinkDragDrop.svelte";
import BookmarksScreen from "lib/Screens/BookmarksScreen.svelte"; import BookmarksScreen from "lib/Screens/BookmarksScreen.svelte";
import RemoteControlScreen from "lib/Screens/RemoteControlScreen.svelte"; import RemoteControlScreen from "lib/Screens/RemoteControlScreen.svelte";
import { fetchLocale } from "lib/Api/Locale";
onMount(async () => { onMount(async () => {
PlayletApi.getState().then((value) => { PlayletApi.getState().then((value) => {
playletStateStore.set(value); playletStateStore.set(value);
fetchLocale(value.device?.current_locale);
}); });
PlayletApi.getHomeLayout().then((value) => { 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(); 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() { static async getPreferencesFile() {
const response = await fetch(`${PlayletApi.host()}/config/preferences.json5`); const response = await fetch(`${PlayletApi.host()}/config/preferences.json5`);
return await response.json(); return await response.json();
+7 -7
View File
@@ -6,7 +6,7 @@
import BookmarksIcon from "../assets/star-icon.svg.svelte"; import BookmarksIcon from "../assets/star-icon.svg.svelte";
import RemoteIcon from "../assets/remote-control.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 { ScreenNames, type AppState } from "lib/Types";
import { onMount } from "svelte"; import { onMount } from "svelte";
@@ -57,7 +57,7 @@
<div class="h-6"> <div class="h-6">
<SearchIcon /> <SearchIcon />
</div> </div>
<span class="text-xs">Search</span> <span class="text-xs">{$tr("Search")}</span>
</button> </button>
<button <button
on:click={() => setScreen("home")} on:click={() => setScreen("home")}
@@ -66,7 +66,7 @@
<div class="h-6"> <div class="h-6">
<HomeIcon /> <HomeIcon />
</div> </div>
<span class="text-xs">Home</span> <span class="text-xs">{$tr("Home")}</span>
</button> </button>
<button <button
on:click={() => setScreen("bookmarks")} on:click={() => setScreen("bookmarks")}
@@ -75,7 +75,7 @@
<div class="h-6"> <div class="h-6">
<BookmarksIcon /> <BookmarksIcon />
</div> </div>
<span class="text-xs">Bookmarks</span> <span class="text-xs">{$tr("Bookmarks")}</span>
</button> </button>
<button <button
on:click={() => setScreen("settings")} on:click={() => setScreen("settings")}
@@ -84,7 +84,7 @@
<div class="h-6"> <div class="h-6">
<SettingsIcon /> <SettingsIcon />
</div> </div>
<span class="text-xs">Settings</span> <span class="text-xs">{$tr("Settings")}</span>
</button> </button>
<button <button
on:click={() => setScreen("remote")} on:click={() => setScreen("remote")}
@@ -93,7 +93,7 @@
<div class="h-6"> <div class="h-6">
<RemoteIcon /> <RemoteIcon />
</div> </div>
<span class="text-xs">Remote</span> <span class="text-xs">{$tr("Remote")}</span>
</button> </button>
<button <button
on:click={() => setScreen("info")} on:click={() => setScreen("info")}
@@ -102,6 +102,6 @@
<div class="h-6"> <div class="h-6">
<InfoIcon /> <InfoIcon />
</div> </div>
<span class="text-xs">Info</span> <span class="text-xs">{$tr("Info")}</span>
</button> </button>
</div> </div>
+3 -8
View File
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { onDestroy, onMount } from "svelte"; import { onDestroy, onMount } from "svelte";
import { playletStateStore } from "lib/Stores"; import { playletStateStore, tr } from "lib/Stores";
import { InvidiousApi } from "lib/Api/InvidiousApi"; import { InvidiousApi } from "lib/Api/InvidiousApi";
import VideoCastDialog from "./VideoFeed/VideoCastDialog.svelte"; import VideoCastDialog from "./VideoFeed/VideoCastDialog.svelte";
import ChannelCastDialog from "./VideoFeed/ChannelCastDialog.svelte"; import ChannelCastDialog from "./VideoFeed/ChannelCastDialog.svelte";
@@ -17,15 +17,10 @@
let videoMetadata; let videoMetadata;
let channelMetadata; let channelMetadata;
let tvName = "Roku TV";
let invidiousInstance;
let invidiousApi = new InvidiousApi(); let invidiousApi = new InvidiousApi();
playletStateStore.subscribe((value) => { playletStateStore.subscribe((value) => {
tvName = value?.device?.friendly_name ?? "Roku TV"; invidiousApi.instance = value?.invidious?.current_instance;
invidiousApi.instance = invidiousInstance =
value?.invidious?.current_instance;
}); });
onMount(async () => { onMount(async () => {
@@ -199,7 +194,7 @@
: 'hidden'} fixed w-full h-full bg-base-100/80 z-50 flex justify-center items-center" : 'hidden'} fixed w-full h-full bg-base-100/80 z-50 flex justify-center items-center"
> >
{#if isDragging} {#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} {:else if isLoading}
<span class="loading loading-spinner loading-md" /> <span class="loading loading-spinner loading-md" />
{/if} {/if}
+7 -7
View File
@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { playletStateStore } from "lib/Stores"; import { playletStateStore, tr } from "lib/Stores";
import { PlayletApi } from "./Api/PlayletApi"; import { PlayletApi } from "./Api/PlayletApi";
import { get } from "svelte/store"; import { get } from "svelte/store";
@@ -66,7 +66,7 @@
<dialog bind:this={modal} class="modal"> <dialog bind:this={modal} class="modal">
<form method="dialog" class="modal-box bg-base-100"> <form method="dialog" class="modal-box bg-base-100">
<div class="flex flex-col items-center"> <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} {#each profiles as profile}
<div class="collapse collapse-arrow bg-base-300 m-1"> <div class="collapse collapse-arrow bg-base-300 m-1">
@@ -109,12 +109,12 @@
{#if profile.id !== currentProfile?.id} {#if profile.id !== currentProfile?.id}
<button <button
on:click={() => activate(profile.id)} on:click={() => activate(profile.id)}
class="btn btn-primary m-1">Activate</button class="btn btn-primary m-1">{$tr("Activate")}</button
> >
{/if} {/if}
<button <button
on:click={() => logout(profile.id)} on:click={() => logout(profile.id)}
class="btn btn-primary m-1">Logout</button class="btn btn-primary m-1">{$tr("Logout")}</button
> >
</div> </div>
</div> </div>
@@ -122,15 +122,15 @@
<div class="flex items-center"> <div class="flex items-center">
<button class="btn btn-primary" on:click={login}> <button class="btn btn-primary" on:click={login}>
<div class=""> <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 class="text-xs font-light">{currentInstance}</div>
</div> </div>
</button> </button>
<button class="btn m-6" on:click={close}>Close</button> <button class="btn m-6" on:click={close}>{$tr("Close")}</button>
</div> </div>
</div> </div>
</form> </form>
<form method="dialog" class="modal-backdrop"> <form method="dialog" class="modal-backdrop">
<button on:click={close}>Close</button> <button on:click={close}>{$tr("Close")}</button>
</form> </form>
</dialog> </dialog>
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import VideoListRow from "lib/VideoFeed/VideoListRow.svelte"; import VideoListRow from "lib/VideoFeed/VideoListRow.svelte";
import { bookmarksStore } from "lib/Stores"; import { bookmarksStore, tr } from "lib/Stores";
export let visibility: boolean; export let visibility: boolean;
</script> </script>
@@ -10,12 +10,13 @@
<div <div
class="flex flex-col items-center justify-start h-screen w-2/3 mx-auto" 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"> <div class="text-gray-500 text-center">
You currently have no bookmarks.<br /> {$tr("You currently have no bookmarks.")}<br />
To add bookmarks, select a video, playlist or channel, and add a bookmark.<br {$tr(
/> "To add bookmarks, select a video, playlist or channel, and add a bookmark."
Please note that Bookmarks is an experimental feature. )}<br />
{$tr("Please note that Bookmarks is an experimental feature.")}
</div> </div>
</div> </div>
{:else} {:else}
+14 -12
View File
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { getHost } from "lib/Api/Host"; import { getHost } from "lib/Api/Host";
import { playletStateStore } from "lib/Stores"; import { playletStateStore, tr } from "lib/Stores";
export let visibility: boolean; export let visibility: boolean;
@@ -87,6 +87,8 @@
const feedbackTitle = encodeURIComponent("[Feedback] Playlet"); const feedbackTitle = encodeURIComponent("[Feedback] Playlet");
let githubUrlIssue = "https://github.com/iBicha/playlet/issues/new"; let githubUrlIssue = "https://github.com/iBicha/playlet/issues/new";
let mailToUrl = "mailto:brahim.hadriche@gmail.com"; 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) => { playletStateStore.subscribe((value) => {
appInfo = value.app || {}; appInfo = value.app || {};
@@ -141,17 +143,17 @@ ${JSON.stringify(profilesInfo, null, 2)}
<div class={visibility ? "" : "hidden"}> <div class={visibility ? "" : "hidden"}>
<div class="text-base text-center m-8"> <div class="text-base text-center m-8">
Thank you for using Playlet.<br /> You have feedback? Let us know by {@html $tr(feedbackMessageRaw)
<a .replace(
class="link" "%IssueStart%",
href={githubUrlIssue} `<a class="link" href="${githubUrlIssue}" target="_blank" rel="noopener noreferrer">`
target="_blank" )
rel="noopener noreferrer">creating an issue on Github</a .replace("%IssueEnd%", "</a>")
> .replace(
or by "%EmailStart%",
<a class="link" href={mailToUrl} target="_blank" rel="noopener noreferrer" `<a class="link" href="${mailToUrl}" target="_blank" rel="noopener noreferrer">`
>sending an email</a )
>. .replace("%EmailEnd%", "</a>")}
</div> </div>
<div class="overflow-x-auto"> <div class="overflow-x-auto">
<table class="table"> <table class="table">
@@ -1,7 +1,9 @@
<script lang="ts"> <script lang="ts">
import { tr } from "lib/Stores";
let modal; let modal;
export let label = "Filters"; export let label = $tr("Filters");
export const filters = { export const filters = {
date: "", date: "",
@@ -28,7 +30,7 @@
count += filters.features.length; count += filters.features.length;
count += filters.sort_by ? 1 : 0; count += filters.sort_by ? 1 : 0;
label = `Filters` + `${count > 0 ? ` (${count})` : ""}`; label = $tr("Filters") + `${count > 0 ? ` (${count})` : ""}`;
} }
const options = { const options = {
@@ -239,12 +241,12 @@
<button <button
class="btn btn-outline" class="btn btn-outline"
type="button" type="button"
on:click={() => modal.close()}>Close</button on:click={() => modal.close()}>{$tr("Close")}</button
> >
</div> </div>
</div> </div>
</form> </form>
<form method="dialog" class="modal-backdrop"> <form method="dialog" class="modal-backdrop">
<button>Close</button> <button>{$tr("Close")}</button>
</form> </form>
</dialog> </dialog>
@@ -5,7 +5,7 @@
import { InvidiousApi } from "lib/Api/InvidiousApi"; import { InvidiousApi } from "lib/Api/InvidiousApi";
import { PlayletApi } from "lib/Api/PlayletApi"; 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 VideoCell from "lib/VideoFeed/VideoCell.svelte";
import PlaylistCell from "lib/VideoFeed/PlaylistCell.svelte"; import PlaylistCell from "lib/VideoFeed/PlaylistCell.svelte";
import ChannelCell from "lib/VideoFeed/ChannelCell.svelte"; import ChannelCell from "lib/VideoFeed/ChannelCell.svelte";
@@ -125,7 +125,7 @@
<input <input
type="search" type="search"
dir="auto" dir="auto"
placeholder="Search..." placeholder="{$tr('Search')}..."
class="join-item input w-full border border-neutral rounded-full" class="join-item input w-full border border-neutral rounded-full"
bind:this={searchBox} bind:this={searchBox}
bind:value={searchBoxText} bind:value={searchBoxText}
@@ -205,7 +205,7 @@
await searchVideos(); await searchVideos();
}} }}
> >
Load more {$tr("Load more")}
</button> </button>
</div> </div>
{/if} {/if}
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { PlayletApi } from "lib/Api/PlayletApi"; 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 textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
@@ -23,7 +23,7 @@
<div class="form-control m-5"> <div class="form-control m-5">
<label class="label p-0 cursor-pointer"> <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 <input
type="checkbox" type="checkbox"
name={key} name={key}
@@ -32,5 +32,5 @@
class="checkbox" class="checkbox"
/> />
</label> </label>
<div class="text-xs text-gray-500">{@html description}</div> <div class="text-xs text-gray-500">{@html $tr(description)}</div>
</div> </div>
@@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
import { PlayletApi } from "lib/Api/PlayletApi"; 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"]; const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
@@ -13,14 +14,15 @@
async function clearSeachHistory() { async function clearSeachHistory() {
await PlayletApi.clearSearchHistory(); await PlayletApi.clearSearchHistory();
searchHistoryStore.set([]); searchHistoryStore.set([]);
alert("Search history cleared.");
alert(get(tr)("Search history cleared."));
} }
</script> </script>
<div class="m-5"> <div class="m-5">
<div class={textSizes[level]}>{displayText}</div> <div class={textSizes[level]}>{$tr(displayText)}</div>
<div class="text-xs text-gray-500">{@html description}</div> <div class="text-xs text-gray-500">{@html $tr(description)}</div>
<button class="btn m-1" on:click={clearSeachHistory} <button class="btn m-1" on:click={clearSeachHistory}
>Clear search history</button >{$tr("Clear search history")}</button
> >
</div> </div>
@@ -2,6 +2,7 @@
import { import {
homeLayoutFileStore, homeLayoutFileStore,
homeLayoutStore, homeLayoutStore,
tr,
userPreferencesStore, userPreferencesStore,
} from "lib/Stores"; } from "lib/Stores";
import ArrowUpIcon from "assets/remote-control/arrow-up.svg.svelte"; import ArrowUpIcon from "assets/remote-control/arrow-up.svg.svelte";
@@ -84,10 +85,10 @@
</script> </script>
<div class="m-5"> <div class="m-5">
<div class={textSizes[level]}>{displayText}</div> <div class={textSizes[level]}>{$tr(displayText)}</div>
<div class="text-xs text-gray-500">{@html description}</div> <div class="text-xs text-gray-500">{@html $tr(description)}</div>
<button class="btn m-1" on:click={openHomeScreenEditor} <button class="btn m-1" on:click={openHomeScreenEditor}
>Edit home screen</button >{$tr("Edit home screen")}</button
> >
</div> </div>
@@ -110,7 +111,7 @@
</td> </td>
<td> <td>
<label class="label p-0 cursor-pointer"> <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 <input
type="checkbox" type="checkbox"
name={item.id} name={item.id}
@@ -134,12 +135,12 @@
{/each} {/each}
</table> </table>
<form method="dialog" class="flex justify-center space-x-2"> <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" on:click={save}>{$tr("Save")}</button>
<button class="btn btn-primary">Close</button> <button class="btn btn-primary">{$tr("Close")}</button>
</form> </form>
{/if} {/if}
</div> </div>
<form method="dialog" class="modal-backdrop"> <form method="dialog" class="modal-backdrop">
<button>Close</button> <button>{$tr("Close")}</button>
</form> </form>
</dialog> </dialog>
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { PlayletApi } from "lib/Api/PlayletApi"; 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 textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
export let displayText: string = ""; export let displayText: string = "";
export let key: string = ""; export let key: string = "";
@@ -21,7 +21,7 @@
<div class="form-control m-5"> <div class="form-control m-5">
<label class="label p-0 cursor-pointer"> <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"> <div class="join mt-2 mb-2">
<button <button
class="join-item btn btn-sm btn-primary" class="join-item btn btn-sm btn-primary"
@@ -52,5 +52,5 @@
</button> </button>
</div> </div>
</label> </label>
<div class="text-xs text-gray-500">{@html description}</div> <div class="text-xs text-gray-500">{@html $tr(description)}</div>
</div> </div>
@@ -1,8 +1,9 @@
<script lang="ts"> <script lang="ts">
import { onMount } from "svelte"; import { onMount } from "svelte";
import { PlayletApi } from "lib/Api/PlayletApi"; import { PlayletApi } from "lib/Api/PlayletApi";
import { playletStateStore } from "lib/Stores"; import { playletStateStore, tr } from "lib/Stores";
import { ExternalControlProtocol } from "lib/Api/ExternalControlProtocol"; import { ExternalControlProtocol } from "lib/Api/ExternalControlProtocol";
import { get } from "svelte/store";
let selectedRelease = ""; let selectedRelease = "";
let releases = []; let releases = [];
@@ -65,23 +66,31 @@
if (version === "") { if (version === "") {
version = "latest"; version = "latest";
} }
const trFn = get(tr);
if ( if (
confirm( 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); 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); await ExternalControlProtocol.restartApp(appId);
} }
} }
</script> </script>
<div class="m-5"> <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"> <div class="text-xs text-gray-500">
The version of Playlet Lib to use. These correspond to tagged releases on {$tr(
Github. Releases that do not have a playlet-lib.zip file are disabled. "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>
<div class="join w-full m-1"> <div class="join w-full m-1">
@@ -89,13 +98,13 @@
bind:value={selectedRelease} bind:value={selectedRelease}
class="select select-bordered join-item w-full mr-1" class="select select-bordered join-item w-full mr-1"
> >
<option selected value="">latest (default)</option> <option selected value=""></option>
{#each releases as release} {#each releases as release}
<option disabled={!release.enabled} value={release.name} <option disabled={!release.enabled} value={release.name}
>{release.name}</option >{release.name}</option
> >
{/each} {/each}
</select> </select>
<button class="join-item btn" on:click={apply}>Apply</button> <button class="join-item btn" on:click={apply}>{$tr("Apply")}</button>
</div> </div>
</div> </div>
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { PlayletApi } from "lib/Api/PlayletApi"; 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 textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
@@ -24,13 +24,13 @@
</script> </script>
<div class="m-5"> <div class="m-5">
<div class={textSizes[level]}>{displayText}</div> <div class={textSizes[level]}>{$tr(displayText)}</div>
<div class="text-xs text-gray-500">{@html description}</div> <div class="text-xs text-gray-500">{@html $tr(description)}</div>
{#each options as option} {#each options as option}
<div class="form-control"> <div class="form-control">
<label class="label cursor-pointer"> <label class="label cursor-pointer">
<span class="label-text">{option.displayText}</span> <span class="label-text">{$tr(option.displayText)}</span>
<input <input
type="radio" type="radio"
name={key} name={key}
@@ -1,8 +1,9 @@
<script lang="ts"> <script lang="ts">
import { PlayletApi } from "lib/Api/PlayletApi"; 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 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 displayText: string = "";
export let key: string = ""; export let key: string = "";
@@ -26,8 +27,14 @@
</script> </script>
<div class="m-5"> <div class="m-5">
<div class={textSizes[level]}>{displayText}</div> <div class={textSizes[level]}>{$tr(displayText)}</div>
<div class="text-xs text-gray-500">{@html description}</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"> <div class="join w-full m-1">
<input <input
@@ -38,7 +45,7 @@
class="join-item input w-full mr-1" class="join-item input w-full mr-1"
/> />
{#if inputValue !== currentValue} {#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} {/if}
</div> </div>
</div> </div>
@@ -6,6 +6,7 @@
import RadioControl from "lib/Screens/Settings/SettingControls/RadioControl.svelte"; import RadioControl from "lib/Screens/Settings/SettingControls/RadioControl.svelte";
import StringControl from "lib/Screens/Settings/SettingControls/StringControl.svelte"; import StringControl from "lib/Screens/Settings/SettingControls/StringControl.svelte";
import NumberControl from "./SettingControls/NumberControl.svelte"; import NumberControl from "./SettingControls/NumberControl.svelte";
import { tr } from "lib/Stores";
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"]; const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
@@ -53,8 +54,8 @@
/> />
{:else} {:else}
<div class="m-5"> <div class="m-5">
<div class={textSizes[level]}>{displayText}</div> <div class={textSizes[level]}>{$tr(displayText)}</div>
<div class="text-xs text-gray-500">{description}</div> <div class="text-xs text-gray-500">{$tr(description)}</div>
</div> </div>
{/if} {/if}
+2
View File
@@ -22,3 +22,5 @@ export const homeLayoutFileStore = writable([] as any);
export const bookmarksStore = writable([] as any); export const bookmarksStore = writable([] as any);
export const searchHistoryStore = 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"> <script lang="ts">
import { InvidiousApi } from "lib/Api/InvidiousApi"; 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 VideoCell from "./VideoCell.svelte";
import PlaylistCell from "./PlaylistCell.svelte"; import PlaylistCell from "./PlaylistCell.svelte";
import ChannelCell from "./ChannelCell.svelte"; import ChannelCell from "./ChannelCell.svelte";
@@ -263,7 +263,7 @@
--> -->
{#if feedLoadState !== FeedLoadState.Loaded || videos.length !== 0} {#if feedLoadState !== FeedLoadState.Loaded || videos.length !== 0}
<div class="text-lg font-semibold ml-4"> <div class="text-lg font-semibold ml-4">
{feed.title} {$tr(feed.title)}
</div> </div>
<div <div
class="carousel carousel-center rounded-box w-full space-x-4" class="carousel carousel-center rounded-box w-full space-x-4"
@@ -196,6 +196,16 @@ export class LocaleValidationPlugin implements CompilerPlugin {
severity: DiagnosticSeverity.Error, severity: DiagnosticSeverity.Error,
code: 'LOCALE_MISSING_TRANSLATIONS', 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}`);
} }
} }