diff --git a/playlet-lib/src/components/ChannelView/ChannelView.bs b/playlet-lib/src/components/ChannelView/ChannelView.bs index 0d1bb9e1..7769f4a6 100644 --- a/playlet-lib/src/components/ChannelView/ChannelView.bs +++ b/playlet-lib/src/components/ChannelView/ChannelView.bs @@ -217,6 +217,7 @@ function InitializeSortOptions() end function function CreateChannelFeed(title as string, endpoint as string, ucid as string, author as string) as object + title = Tr(title) return { title: title feedSources: [{ @@ -257,7 +258,7 @@ function GetSortingContextMenuOptionsForItem(video as object) as object return [] end if - title = Tr(Locale.Dialogs.SortFeedBy).replace("%1", feedContentNode.title) + title = Tr(Locale.Dialogs.SortFeedBy).replace("%1", `"${feedSource.title}"`) sortOptions = m.sortOptions[endpoint] return [ContextMenuUtils.CreateOption(title + "...", m.top, "ShowSortDialog", [title, sortOptions, feedContentNode])] diff --git a/playlet-lib/src/components/PlaylistView/PlaylistView.bs b/playlet-lib/src/components/PlaylistView/PlaylistView.bs index 2ba6f488..4bbd2ac5 100644 --- a/playlet-lib/src/components/PlaylistView/PlaylistView.bs +++ b/playlet-lib/src/components/PlaylistView/PlaylistView.bs @@ -163,10 +163,10 @@ function GetContextMenuOptionsForItem(video as object) as object end if options = [ - ContextMenuUtils.CreateOption("Play", m.videoQueue, "FuncPlayPlaylist", [playlist, index]), - ContextMenuUtils.CreateOption("Queue", m.videoQueue, "FuncAddToQueuePlaylist", [playlist]) - ContextMenuUtils.CreateOption("Play video", m.videoQueue, "FuncPlayVideo", [video]), - ContextMenuUtils.CreateOption("Queue video", m.videoQueue, "FuncAddToQueueVideo", [video]), + ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.PlayPlaylist), m.videoQueue, "FuncPlayPlaylist", [playlist, index]), + ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.QueuePlaylist), m.videoQueue, "FuncAddToQueuePlaylist", [playlist]) + ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.PlayVideo), m.videoQueue, "FuncPlayVideo", [video]), + ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.QueueVideo), m.videoQueue, "FuncAddToQueueVideo", [video]), ] playlistAuthorId = playlist.authorId @@ -174,13 +174,13 @@ function GetContextMenuOptionsForItem(video as object) as object if not StringUtils.IsNullOrEmpty(playlistAuthorId) or not StringUtils.IsNullOrEmpty(videoAuthorId) if playlistAuthorId = videoAuthorId - options.push(ContextMenuUtils.CreateOption("Open channel", m.top, "OpenPlaylistChannel", [playlist])) + options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.OpenChannel), m.top, "OpenPlaylistChannel", [playlist])) else if not StringUtils.IsNullOrEmpty(playlistAuthorId) - options.push(ContextMenuUtils.CreateOption("Open playlist channel", m.top, "OpenPlaylistChannel", [playlist])) + options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.OpenPlaylistChannel), m.top, "OpenPlaylistChannel", [playlist])) end if if not StringUtils.IsNullOrEmpty(videoAuthorId) - options.push(ContextMenuUtils.CreateOption("Open video channel", m.top, "OpenVideoChannel", [video])) + options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.OpenVideoChannel), m.top, "OpenVideoChannel", [video])) end if end if end if diff --git a/playlet-lib/src/components/Screens/BookmarksScreen/BookmarksScreen.bs b/playlet-lib/src/components/Screens/BookmarksScreen/BookmarksScreen.bs index 37592fb1..f35828cf 100644 --- a/playlet-lib/src/components/Screens/BookmarksScreen/BookmarksScreen.bs +++ b/playlet-lib/src/components/Screens/BookmarksScreen/BookmarksScreen.bs @@ -1,6 +1,7 @@ import "pkg:/components/ContextMenu/ContextMenuUtils.bs" import "pkg:/components/Navigation/Navigation.bs" import "pkg:/source/utils/FocusManagement.bs" +import "pkg:/source/utils/Locale.bs" import "pkg:/source/utils/Types.bs" function Init() @@ -95,6 +96,6 @@ function OnkeyEvent(key as string, press as boolean) as boolean end function function GetContextMenuOptionsForItem(rowItem as object) as object - refreshItem = ContextMenuUtils.CreateOption("Refresh Bookmarks", m.top, "Refresh", [invalid]) + refreshItem = ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.RefreshBookmarks), m.top, "Refresh", [invalid]) return [refreshItem] end function diff --git a/playlet-lib/src/components/Screens/HomeScreen/HomeScreen.bs b/playlet-lib/src/components/Screens/HomeScreen/HomeScreen.bs index 1d7eb135..ab1fefd4 100644 --- a/playlet-lib/src/components/Screens/HomeScreen/HomeScreen.bs +++ b/playlet-lib/src/components/Screens/HomeScreen/HomeScreen.bs @@ -2,6 +2,7 @@ import "HomeScreenUtils.bs" import "pkg:/components/ContextMenu/ContextMenuUtils.bs" import "pkg:/components/Navigation/Navigation.bs" import "pkg:/source/utils/FocusManagement.bs" +import "pkg:/source/utils/Locale.bs" function Init() m.top.focusable = true @@ -41,6 +42,6 @@ function OnkeyEvent(key as string, press as boolean) as boolean end function function GetContextMenuOptionsForItem(rowItem as object) as object - refresh = ContextMenuUtils.CreateOption("Refresh Home", m.rowList, "Refresh", [invalid]) + refresh = ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.RefreshHome), m.rowList, "Refresh", [invalid]) return [refresh] end function diff --git a/playlet-lib/src/components/Screens/HomeScreen/HomeScreenUtils.bs b/playlet-lib/src/components/Screens/HomeScreen/HomeScreenUtils.bs index 41edfc97..11160540 100644 --- a/playlet-lib/src/components/Screens/HomeScreen/HomeScreenUtils.bs +++ b/playlet-lib/src/components/Screens/HomeScreen/HomeScreenUtils.bs @@ -4,6 +4,13 @@ namespace HomeScreenUtils function GetFeed(feedFileName as string, preferences as object) as object feed = ParseJson(ReadAsciiFile(feedFileName)) + for each item in feed + item.title = Tr(item.title) + + for each feedSource in item.feedSources + feedSource.title = Tr(feedSource.title) + end for + end for homeLayout = preferences["misc.home_screen_layout"] if not IsArray(homeLayout) or homeLayout.Count() = 0 diff --git a/playlet-lib/src/components/Services/BookmarksService/BookmarksService.bs b/playlet-lib/src/components/Services/BookmarksService/BookmarksService.bs index 5bf6a33c..7bb2ea41 100644 --- a/playlet-lib/src/components/Services/BookmarksService/BookmarksService.bs +++ b/playlet-lib/src/components/Services/BookmarksService/BookmarksService.bs @@ -1,14 +1,11 @@ import "pkg:/components/ContextMenu/ContextMenuUtils.bs" import "pkg:/source/utils/CryptoUtils.bs" +import "pkg:/source/utils/Locale.bs" import "pkg:/source/utils/Logging.bs" import "pkg:/source/utils/RegistryUtils.bs" import "pkg:/source/utils/StringUtils.bs" import "pkg:/source/utils/Types.bs" -const VIDEOS_GROUP = "Videos" -const CHANNELS_GROUP = "Channels" -const PLAYLISTS_GROUP = "Playlists" - function Init() m.top.content = m.top.findNode("content") m.bookmarksString = "" @@ -140,7 +137,7 @@ function AddPlaylistBookmarkWithSpread(id as string, groupName as string) feedSource = { "id": `inv_playlist_${id}` - "title": `${groupName} videos` + "title": `${groupName} ${Tr(Locale.Feed.Videos)}` "apiType": "Invidious" "endpoint": "playlist" "pathParams": { @@ -177,7 +174,7 @@ function AddChannelBookmarkWithSpread(id as string, groupName as string) feedSource = { "id": `inv_channel_videos_${id}` - "title": `${groupName} videos` + "title": `${groupName} ${Tr(Locale.Feed.Videos)}` "apiType": "Invidious" "endpoint": "channel_videos" "pathParams": { @@ -241,10 +238,14 @@ function GetMenuForVideo(videoNode as object) as object isInBookmarks = bookmark <> invalid if isInBookmarks bookmarkGroup = bookmark.getParent() - item = ContextMenuUtils.CreateOption(`Remove from "${bookmarkGroup.title}" bookmarks`, m.top, "RemoveBookmark", [videoId]) + title = Tr(Locale.ContextMenu.RemoveFromBookmarks).Replace("%1", `"${bookmarkGroup.title}"`) + item = ContextMenuUtils.CreateOption(title, m.top, "RemoveBookmark", [videoId]) menu.push(item) else - item = ContextMenuUtils.CreateOption(`Add to "${VIDEOS_GROUP}" bookmark`, m.top, "AddVideoBookmark", [videoId, VIDEOS_GROUP]) + ' "Videos" exists in feed + group = Tr(Locale.Feed.Videos) + title = Tr(Locale.ContextMenu.AddToBookmark).Replace("%1", `"${group}"`) + item = ContextMenuUtils.CreateOption(title, m.top, "AddVideoBookmark", [videoId, group]) menu.push(item) end if return menu @@ -261,13 +262,18 @@ function GetMenuForPlaylist(playlistNode as object) as object isInBookmarks = bookmark <> invalid if isInBookmarks bookmarkGroup = bookmark.getParent() - item = ContextMenuUtils.CreateOption(`Remove from "${bookmarkGroup.title}" bookmarks`, m.top, "RemoveBookmark", [playlistId]) + title = Tr(Locale.ContextMenu.RemoveFromBookmarks).Replace("%1", `"${bookmarkGroup.title}"`) + item = ContextMenuUtils.CreateOption(title, m.top, "RemoveBookmark", [playlistId]) menu.push(item) else - item = ContextMenuUtils.CreateOption(`Add to "${PLAYLISTS_GROUP}" bookmark`, m.top, "AddPlaylistBookmark", [playlistId, PLAYLISTS_GROUP]) + ' "Playlists" exists in feed + group = Tr(Locale.Feed.Playlists) + title = Tr(Locale.ContextMenu.AddToBookmark).Replace("%1", `"${group}"`) + item = ContextMenuUtils.CreateOption(title, m.top, "AddPlaylistBookmark", [playlistId, group]) menu.push(item) - item = ContextMenuUtils.CreateOption(`Add to "${playlistNode.title}" bookmark`, m.top, "AddPlaylistBookmarkWithSpread", [playlistId, playlistNode.title]) + title = Tr(Locale.ContextMenu.AddToBookmark).Replace("%1", `"${playlistNode.title}"`) + item = ContextMenuUtils.CreateOption(title, m.top, "AddPlaylistBookmarkWithSpread", [playlistId, playlistNode.title]) menu.push(item) end if return menu @@ -284,13 +290,17 @@ function GetMenuForChannel(channelNode as object) as object isInBookmarks = bookmark <> invalid if isInBookmarks bookmarkGroup = bookmark.getParent() - item = ContextMenuUtils.CreateOption(`Remove from "${bookmarkGroup.title}" bookmarks`, m.top, "RemoveBookmark", [authorId]) + title = Tr(Locale.ContextMenu.RemoveFromBookmarks).Replace("%1", `"${bookmarkGroup.title}"`) + item = ContextMenuUtils.CreateOption(title, m.top, "RemoveBookmark", [authorId]) menu.push(item) else - item = ContextMenuUtils.CreateOption(`Add to "${CHANNELS_GROUP}" bookmark`, m.top, "AddChannelBookmark", [authorId, CHANNELS_GROUP]) + group = Tr(Locale.Bookmarks.Channels) + title = Tr(Locale.ContextMenu.AddToBookmark).Replace("%1", `"${group}"`) + item = ContextMenuUtils.CreateOption(title, m.top, "AddChannelBookmark", [authorId, group]) menu.push(item) - item = ContextMenuUtils.CreateOption(`Add to "${channelNode._author}" bookmark`, m.top, "AddChannelBookmarkWithSpread", [authorId, channelNode._author]) + title = Tr(Locale.ContextMenu.AddToBookmark).Replace("%1", `"${channelNode._author}"`) + item = ContextMenuUtils.CreateOption(title, m.top, "AddChannelBookmarkWithSpread", [authorId, channelNode._author]) menu.push(item) end if return menu @@ -316,17 +326,19 @@ function GetMenuForParentFeedSource(itemNode as object) as object return [] end if - title = feedSource.title + feedSourceTitle = feedSource.title feedSourceId = feedSource.id menu = [] isInBookmarks = m.top.content.findNode(feedSourceId) <> invalid if isInBookmarks - item = ContextMenuUtils.CreateOption(`Remove "${feedSource.title}" from bookmarks`, m.top, "RemoveBookmark", [feedSourceId]) + title = Tr(Locale.ContextMenu.RemoveFromBookmarks).Replace("%1", `"${feedSourceTitle}"`) + item = ContextMenuUtils.CreateOption(title, m.top, "RemoveBookmark", [feedSourceId]) menu.push(item) else - item = ContextMenuUtils.CreateOption(`Add to "${title}" bookmark`, m.top, "AddFeedSourceBookmark", [feedSource, feedSourceId, title]) + title = Tr(Locale.ContextMenu.AddToBookmark).Replace("%1", `"${feedSourceTitle}"`) + item = ContextMenuUtils.CreateOption(title, m.top, "AddFeedSourceBookmark", [feedSource, feedSourceId, feedSourceTitle]) menu.push(item) end if return menu diff --git a/playlet-lib/src/components/VideoFeed/VideoRowList.bs b/playlet-lib/src/components/VideoFeed/VideoRowList.bs index 52d1866f..e503448b 100644 --- a/playlet-lib/src/components/VideoFeed/VideoRowList.bs +++ b/playlet-lib/src/components/VideoFeed/VideoRowList.bs @@ -145,25 +145,25 @@ function GetContextMenuOptionsForItem(rowItem as object) as object options = [] if rowItem.type = "video" - options.push(ContextMenuUtils.CreateOption("Play", m.videoQueue, "FuncPlayVideo", [rowItem])) - options.push(ContextMenuUtils.CreateOption("Queue", m.videoQueue, "FuncAddToQueueVideo", [rowItem])) + options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.PlayVideo), m.videoQueue, "FuncPlayVideo", [rowItem])) + options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.QueueVideo), m.videoQueue, "FuncAddToQueueVideo", [rowItem])) authorId = rowItem.authorId if not StringUtils.IsNullOrEmpty(authorId) - options.push(ContextMenuUtils.CreateOption("Open channel", m.top, "OpenVideoChannel", [rowItem])) + options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.OpenChannel), m.top, "OpenVideoChannel", [rowItem])) end if else if rowItem.type = "playlist" - options.push(ContextMenuUtils.CreateOption("Play", m.videoQueue, "FuncPlayPlaylist", [rowItem, 0])) - options.push(ContextMenuUtils.CreateOption("Queue", m.videoQueue, "FuncAddToQueuePlaylist", [rowItem])) + options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.PlayPlaylist), m.videoQueue, "FuncPlayPlaylist", [rowItem, 0])) + options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.QueuePlaylist), m.videoQueue, "FuncAddToQueuePlaylist", [rowItem])) - options.push(ContextMenuUtils.CreateOption("Open playlist", m.top, "OpenPlaylist", [rowItem])) + options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.OpenPlaylist), m.top, "OpenPlaylist", [rowItem])) authorId = rowItem.authorId if not StringUtils.IsNullOrEmpty(authorId) - options.push(ContextMenuUtils.CreateOption("Open channel", m.top, "OpenPlaylistChannel", [rowItem])) + options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.OpenChannel), m.top, "OpenPlaylistChannel", [rowItem])) end if else if rowItem.type = "channel" - options.push(ContextMenuUtils.CreateOption("Open", m.top, "OpenChannel", [rowItem])) + options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.OpenChannel), m.top, "OpenChannel", [rowItem])) else LogWarn("Unknown long pressed item type:", rowItem.type) return [] diff --git a/playlet-lib/src/components/VideoFeed/VideoRowListContentTask.bs b/playlet-lib/src/components/VideoFeed/VideoRowListContentTask.bs index 7d5feec3..d816b426 100644 --- a/playlet-lib/src/components/VideoFeed/VideoRowListContentTask.bs +++ b/playlet-lib/src/components/VideoFeed/VideoRowListContentTask.bs @@ -10,7 +10,7 @@ function VideoRowListContentTask(input as object) for each feed in feeds feedContentNode = CreateObject("roSGNode", "FeedContentNode") - feedContentNode.title = Tr(feed.title) + feedContentNode.title = feed.title feedContentNode.feedSourcesIndex = 0 feedContentNode.loadState = FeedLoadState.None feedSources = feed.feedSources diff --git a/playlet-lib/src/locale/en_US/translations.ts b/playlet-lib/src/locale/en_US/translations.ts index cef57373..de9cf0ab 100644 --- a/playlet-lib/src/locale/en_US/translations.ts +++ b/playlet-lib/src/locale/en_US/translations.ts @@ -624,6 +624,10 @@ Please note that Bookmarks is an experimental feature. Please note that Bookmarks is an experimental feature. + + Channels + Channels + Could not get IP address: are we connected to the internet? Could not get IP address: are we connected to the internet? @@ -1056,5 +1060,53 @@ Start at Start at + + Play Video + Play Video + + + Queue Video + Queue Video + + + Play Playlist + Play Playlist + + + Queue Playlist + Queue Playlist + + + Open Channel + Open Channel + + + Open Playlist + Open Playlist + + + Open Playlist Channel + Open Playlist Channel + + + Open Video Channel + Open Video Channel + + + Refresh Home + Refresh Home + + + Refresh Bookmarks + Refresh Bookmarks + + + Remove from %1 bookmarks + Remove from %1 bookmarks + + + Add to %1 bookmark + Add to %1 bookmark + \ No newline at end of file diff --git a/playlet-lib/src/locale/fr_CA/translations.ts b/playlet-lib/src/locale/fr_CA/translations.ts index 1e3e5b7e..cc27912e 100644 --- a/playlet-lib/src/locale/fr_CA/translations.ts +++ b/playlet-lib/src/locale/fr_CA/translations.ts @@ -621,6 +621,10 @@ Please note that Bookmarks is an experimental feature. Veuillez noter que les favoris sont une fonctionnalité expérimentale. + + Channels + Chaînes + Could not get IP address: are we connected to the internet? Impossible d'obtenir l'adresse IP: est-on connecté à Internet? @@ -1054,5 +1058,53 @@ Start at Démarrer à + + Play Video + Lire la vidéo + + + Queue Video + Mettre en file d'attente la vidéo + + + Play Playlist + Lire la playlist + + + Queue Playlist + Mettre en file d'attente la playlist + + + Open Channel + Ouvrir la chaîne + + + Open Playlist + Ouvrir la playlist + + + Open Playlist Channel + Ouvrir la chaîne de la playlist + + + Open Video Channel + Ouvrir la chaîne de la vidéo + + + Refresh Home + Actualiser la page d'accueil + + + Refresh Bookmarks + Actualiser les favoris + + + Remove from %1 bookmarks + Retirer des favoris %1 + + + Add to %1 bookmark + Ajouter au favori %1 + \ No newline at end of file diff --git a/playlet-lib/src/source/utils/Locale.bs b/playlet-lib/src/source/utils/Locale.bs index b86729b6..31d34081 100644 --- a/playlet-lib/src/source/utils/Locale.bs +++ b/playlet-lib/src/source/utils/Locale.bs @@ -201,6 +201,7 @@ namespace Locale YouCurrentlyHaveNoBookmarks = "You currently have no bookmarks." ToAddBookmarksInstructions = "To add bookmarks, long-press 'OK' on a video, playlist or channel." BookmarksAreExperimental = "Please note that Bookmarks is an experimental feature." + Channels = "Channels" end enum @locale @@ -360,4 +361,20 @@ namespace Locale StartAt = "Start at" end enum + @locale + enum ContextMenu + PlayVideo = "Play Video" + QueueVideo = "Queue Video" + PlayPlaylist = "Play Playlist" + QueuePlaylist = "Queue Playlist" + OpenChannel = "Open Channel" + OpenPlaylist = "Open Playlist" + OpenPlaylistChannel = "Open Playlist Channel" + OpenVideoChannel = "Open Video Channel" + RefreshHome = "Refresh Home" + RefreshBookmarks = "Refresh Bookmarks" + RemoveFromBookmarks = "Remove from %1 bookmarks" + AddToBookmark = "Add to %1 bookmark" + end enum + end namespace diff --git a/playlet-lib/src/source/utils/LocaleUtils.bs b/playlet-lib/src/source/utils/LocaleUtils.bs index 6ad0b539..001f2ee2 100644 --- a/playlet-lib/src/source/utils/LocaleUtils.bs +++ b/playlet-lib/src/source/utils/LocaleUtils.bs @@ -1,5 +1,4 @@ ' TODO:P2 Translations left: -' - Context menu ' - Search filters (App+Web) ' - Loading messages diff --git a/playlet-web/src/lib/Api/Locale.ts b/playlet-web/src/lib/Api/Locale.ts index 8a81a239..8d515fd6 100644 --- a/playlet-web/src/lib/Api/Locale.ts +++ b/playlet-web/src/lib/Api/Locale.ts @@ -60,7 +60,7 @@ export function getFormattedPluralString(c: number, zeroString: string, oneStrin return trFn(oneString); } else { if (c < 1000) { - return trFn(pluralString).replace("^n", parseFloat(c.toFixed(1)).toString()); + return trFn(pluralString).replace("^n", c.toString()); } c = c / 1000; if (c < 1000) {