diff --git a/playlet-lib/src/components/AppController/AppController.bs b/playlet-lib/src/components/AppController/AppController.bs index 8d047bfc..d33b47b2 100644 --- a/playlet-lib/src/components/AppController/AppController.bs +++ b/playlet-lib/src/components/AppController/AppController.bs @@ -126,7 +126,7 @@ function onKeyEvent(key as string, press as boolean) as boolean return true end if end if - dialog = DialogUtils.ShowDialogButtons("Do you want to exit Playlet?", Tr(Locale.Buttons.exit), [Tr(Locale.Buttons.exit), Tr(Locale.Buttons.Cancel)]) + dialog = DialogUtils.ShowDialogButtons(Tr(Locale.Dialogs.ExitPlayletQuestion), Tr(Locale.Buttons.exit), [Tr(Locale.Buttons.exit), Tr(Locale.Buttons.Cancel)]) dialog.observeField("buttonSelected", FuncName(OnExitDialog), ["buttonSelected"]) return true end if diff --git a/playlet-lib/src/components/Dialog/LoginDialog.bs b/playlet-lib/src/components/Dialog/LoginDialog.bs index bfe15aaa..85f5e70e 100644 --- a/playlet-lib/src/components/Dialog/LoginDialog.bs +++ b/playlet-lib/src/components/Dialog/LoginDialog.bs @@ -12,7 +12,7 @@ function Init() m.top.observeFieldScoped("buttonSelected", FuncName(Close)) scanLabel = m.top.findNode("scanLabel") - scanLabel.text = Tr(Locale.LoginDialog.ScanTheQrCode) + scanLabel.text = Tr(Locale.Dialogs.ScanTheQrCode) end function function OnNodeReady() @@ -21,7 +21,7 @@ function OnNodeReady() if isValidAddress m.top.url = `${address}/invidious/login` else - m.urlLabel.text = Tr(Locale.LoginDialog.IpAddressNotAvailable) + m.urlLabel.text = Tr(Locale.Dialogs.IpAddressNotAvailable) end if m.invidious.observeFieldScoped("authToken", FuncName(OnAuthTokenChange)) diff --git a/playlet-lib/src/components/Screens/BookmarksScreen/BookmarksScreen.xml b/playlet-lib/src/components/Screens/BookmarksScreen/BookmarksScreen.xml index b51bb4ad..175db836 100644 --- a/playlet-lib/src/components/Screens/BookmarksScreen/BookmarksScreen.xml +++ b/playlet-lib/src/components/Screens/BookmarksScreen/BookmarksScreen.xml @@ -7,14 +7,26 @@ - "${m.loungeService.deviceName}"` + deviceName = `"${m.loungeService.deviceName}"` + m.wifiInstructionWithDeviceNameLabel.text = Tr(Locale.RemoteScreen.WifiInstruction3).Replace("%1", deviceName) end function function OnLinkWithTvPanelVisibleChanged() @@ -159,7 +179,7 @@ function GeneratePairingCode() m.linkCodeTask.cancel = true end if - m.linkCodeLabel.text = "Loading..." + m.linkCodeLabel.text = Tr(Locale.RemoteScreen.Loading) m.linkCodeTask = AsyncTask.Start(Tasks.LoungeGenerateManualPairingCodeTask, { loungeService: m.loungeService loungeToken: m.loungeService.loungeToken @@ -187,8 +207,8 @@ function OnLoungeGenerateManualPairingCodeTaskResult(output as object) as void error = ErrorUtils.Format(error) LogError(error) - message = `Failed to generate manual pairing code\n${error}` - DialogUtils.ShowDialog(message, "Get TV code fail", true) + message = Tr(Locale.RemoteScreen.FailedToGeneratePairingCode) + `\n${error}` + DialogUtils.ShowDialog(message, Tr(Locale.RemoteScreen.TvCodeError), true) return end if diff --git a/playlet-lib/src/components/Screens/RemoteScreen/RemoteScreen.xml b/playlet-lib/src/components/Screens/RemoteScreen/RemoteScreen.xml index 00bb87ac..e94dccfa 100644 --- a/playlet-lib/src/components/Screens/RemoteScreen/RemoteScreen.xml +++ b/playlet-lib/src/components/Screens/RemoteScreen/RemoteScreen.xml @@ -10,11 +10,13 @@ @@ -97,23 +99,23 @@ wrap="true" text="Tap the cast icon and select this device." /> + + - - - + + - diff --git a/playlet-lib/src/components/Screens/SettingsScreen/Checkbox.bs b/playlet-lib/src/components/Screens/SettingsScreen/Checkbox.bs index d47ea218..11c2fd14 100644 --- a/playlet-lib/src/components/Screens/SettingsScreen/Checkbox.bs +++ b/playlet-lib/src/components/Screens/SettingsScreen/Checkbox.bs @@ -1,7 +1,9 @@ +import "pkg:/source/utils/MathUtils.bs" import "pkg:/source/utils/Types.bs" function Init() m.top.observeField("checkedState", FuncName(OnCheckedStateChange)) + m.minItemWidth = m.top.itemSize[0] end function function OnValueChange() @@ -15,3 +17,19 @@ function OnCheckedStateChange() as void end if m.top.value = checkedState[0] end function + +function OnTitleChange() + title = m.top.title + ' TODO:P2 FIX THIS + ' This is a gross estimate of the width of the text, because there isn't + ' a simple way to measure using the font, and accurately estimate the width + ' of the checkbox. I hate it, but I currently don't have the patience to + ' do something else. + ' The risks are, if the checkbox is too big, it will look ugly, and if it's + ' too small, the text will be scrolling. Either way, it will be usable. + ' A better way is to create a Checkbox from scratch, instead of using the CheckList + size = title.len() * 14 - 30 + + size = MathUtils.Max(size, m.minItemWidth) + m.top.itemSize = [size, m.top.itemSize[1]] +end function diff --git a/playlet-lib/src/components/Screens/SettingsScreen/Checkbox.xml b/playlet-lib/src/components/Screens/SettingsScreen/Checkbox.xml index 2c783165..a48e86f7 100644 --- a/playlet-lib/src/components/Screens/SettingsScreen/Checkbox.xml +++ b/playlet-lib/src/components/Screens/SettingsScreen/Checkbox.xml @@ -1,6 +1,6 @@ - + diff --git a/playlet-lib/src/components/Screens/SettingsScreen/ClearSearchHistoryControl.bs b/playlet-lib/src/components/Screens/SettingsScreen/ClearSearchHistoryControl.bs index e14a07dc..61bbe9e7 100644 --- a/playlet-lib/src/components/Screens/SettingsScreen/ClearSearchHistoryControl.bs +++ b/playlet-lib/src/components/Screens/SettingsScreen/ClearSearchHistoryControl.bs @@ -1,6 +1,7 @@ import "pkg:/components/Dialog/DialogUtils.bs" import "pkg:/components/Services/SearchHistory/SearchHistoryUtils.bs" import "pkg:/source/utils/FocusManagement.bs" +import "pkg:/source/utils/Locale.bs" function Init() m.top.focusable = true @@ -22,5 +23,5 @@ end function function OnButtonSelected() SearchHistoryUtils.Clear() - DialogUtils.ShowDialog("Search history cleared.", "Success") + DialogUtils.ShowDialog(Tr(Locale.Settings.SearchHistoryCleared), Tr(Locale.Generic.Success)) end function diff --git a/playlet-lib/src/components/Screens/SettingsScreen/RadioControl.bs b/playlet-lib/src/components/Screens/SettingsScreen/RadioControl.bs index 33821d20..9fb6d63b 100644 --- a/playlet-lib/src/components/Screens/SettingsScreen/RadioControl.bs +++ b/playlet-lib/src/components/Screens/SettingsScreen/RadioControl.bs @@ -57,7 +57,7 @@ function OnOptionsChange() for i = 0 to options.Count() - 1 option = options[i].displayText node = CreateObject("roSGNode", "ContentNode") - node.title = option + node.title = Tr(option) m.radioButtonListContent.appendChild(node) end for diff --git a/playlet-lib/src/components/Screens/SettingsScreen/SettingCategory.bs b/playlet-lib/src/components/Screens/SettingsScreen/SettingCategory.bs index 9e927308..20897174 100644 --- a/playlet-lib/src/components/Screens/SettingsScreen/SettingCategory.bs +++ b/playlet-lib/src/components/Screens/SettingsScreen/SettingCategory.bs @@ -1,3 +1,4 @@ +import "pkg:/source/utils/MathUtils.bs" import "pkg:/source/utils/Types.bs" function Init() @@ -21,7 +22,10 @@ function Resize() width = rect.width + m.top.padding * 2 height = rect.height + m.top.padding * 2 - m.top.minWidth = width < m.top.minimumWidth ? m.top.minimumWidth : width + m.top.contentWidth = width + m.top.contentHeight = height + + m.top.minWidth = MathUtils.Max(m.top.minimumWidth, width) m.top.height = height m.container.translation = [m.top.padding, m.top.padding] diff --git a/playlet-lib/src/components/Screens/SettingsScreen/SettingCategory.xml b/playlet-lib/src/components/Screens/SettingsScreen/SettingCategory.xml index 7251b532..2f61b10e 100644 --- a/playlet-lib/src/components/Screens/SettingsScreen/SettingCategory.xml +++ b/playlet-lib/src/components/Screens/SettingsScreen/SettingCategory.xml @@ -1,7 +1,9 @@ - - + + + + @@ -9,13 +11,11 @@ - - + + + diff --git a/playlet-lib/src/components/Screens/SettingsScreen/SettingsScreen.bs b/playlet-lib/src/components/Screens/SettingsScreen/SettingsScreen.bs index 3c618f7e..6c8b2c26 100644 --- a/playlet-lib/src/components/Screens/SettingsScreen/SettingsScreen.bs +++ b/playlet-lib/src/components/Screens/SettingsScreen/SettingsScreen.bs @@ -20,7 +20,7 @@ function OnNodeReady() startX = 150 startY = 100 - controlsX = 400 + controlsX = 450 categorySpacing = 80 controlSpacing = 30 @@ -73,8 +73,8 @@ end function function CreateCategoryNode(item as object, container as object, startX as integer, startY as integer) as object node = container.createChild("SettingCategory") node.translation = [startX, startY] - node.displayText = item.displayText - node.description = item.description + node.displayText = Tr(item.displayText) + node.description = Tr(item.description) return { node: node rect: node.boundingRect() @@ -152,30 +152,30 @@ end function function CreateBooleanControl(item as object, container as object) as object node = container.createChild("BooleanControl") - node.displayText = item.displayText - node.description = item.description + node.displayText = Tr(item.displayText) + node.description = Tr(item.description) return node end function function CreateRadioControl(item as object, container as object) as object node = container.createChild("RadioControl") - node.displayText = item.displayText - node.description = item.description + node.displayText = Tr(item.displayText) + node.description = Tr(item.description) node.options = item.options return node end function function CreateStringControl(item as object, container as object) as object node = container.createChild("StringControl") - node.displayText = item.displayText - node.description = item.description + node.displayText = Tr(item.displayText) + node.description = Tr(item.description) return node end function function CreateNumberComponent(item as object, container as object) as object node = container.createChild("NumberControl") - node.displayText = item.displayText - node.description = item.description + node.displayText = Tr(item.displayText) + node.description = Tr(item.description) if IsInt(item.min) node.min = item.min end if @@ -188,10 +188,10 @@ end function function CreateRokuComponent(item as object, container as object) as object node = container.createChild(item.rokuComponent) if node.hasField("displayText") - node.displayText = item.displayText + node.displayText = Tr(item.displayText) end if if node.hasField("description") - node.description = item.description + node.description = Tr(item.description) end if return node end function diff --git a/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs b/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs index 285667ac..48af059e 100644 --- a/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs +++ b/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs @@ -128,9 +128,12 @@ function OnVideoContentTaskResults(output as object) as void error = ErrorUtils.Format(error) LogError(error) videoId = output.task.input.content.videoId - message = `Failed to load video information for ${videoId}\n${error}` - dialog = DialogUtils.ShowTimedDialogButtons(message, "Video load fail", ["Play next video", "Cancel"], 0, 10, true) + title = Tr(Locale.VideoPlayer.VideoLoadError) + message = Tr(Locale.VideoPlayer.VideoLoadErrorMessage).Replace("%1", videoId) + `\n${error}` + buttons = [Tr(Locale.Buttons.PlayNextVideo), Tr(Locale.Buttons.Cancel)] + + dialog = DialogUtils.ShowTimedDialogButtons(message, title, buttons, 0, 10, true) dialog.observeFieldScoped("wasClosed", FuncName(OnVideoContentTaskErrorDialogResponse)) Lounge.SendOnStateChange() @@ -186,7 +189,7 @@ function Close(_unused as dynamic) try m.top.control = "stop" catch error - DialogUtils.ShowDialog(ErrorUtils.Format(error), "Error closing video", true) + DialogUtils.ShowDialog(ErrorUtils.Format(error), Tr(Locale.VideoPlayer.ErrorClosingVideo), true) end try m.top.content = invalid @@ -263,10 +266,12 @@ function OnVideoPlayerStateChange() as void end for end if - title = `Error playing video ${content.videoId}` + title = Tr(Locale.VideoPlayer.ErrorPlayingVideo).Replace("%1", content.videoId) LogError(title, messageLines) - dialog = DialogUtils.ShowTimedDialogButtons(messageLines, title, ["Play next video", "Cancel"], 0, 10, true) + buttons = [Tr(Locale.Buttons.PlayNextVideo), Tr(Locale.Buttons.Cancel)] + + dialog = DialogUtils.ShowTimedDialogButtons(messageLines, title, buttons, 0, 10, true) dialog.observeFieldScoped("wasClosed", FuncName(OnVideoContentTaskErrorDialogResponse)) m.ignoreNextFinishedState = true end if diff --git a/playlet-lib/src/locale/en_US/translations.ts b/playlet-lib/src/locale/en_US/translations.ts index 0d3515d2..80487f51 100644 --- a/playlet-lib/src/locale/en_US/translations.ts +++ b/playlet-lib/src/locale/en_US/translations.ts @@ -156,6 +156,10 @@ Please note that an Invidious account is different from a YouTube account. Please note that an Invidious account is different from a YouTube account. + + Do you want to exit Playlet? + Do you want to exit Playlet? + Invidious custom instance Invidious custom instance @@ -208,10 +212,18 @@ No No + + Success + Success + Refresh Refresh + + Play next video + Play next video + Test Test @@ -516,5 +528,285 @@ UPCOMING UPCOMING + + You currently have no bookmarks. + You currently have no bookmarks. + + + To add bookmarks, long-press 'OK' on a video, playlist or channel. + To add bookmarks, long-press 'OK' on a video, playlist or channel. + + + Please note that Bookmarks is an experimental feature. + Please note that Bookmarks is an experimental feature. + + + Could not get IP address: are we connected to the internet? + Could not get IP address: are we connected to the internet? + + + Playlet Web App + Playlet Web App + + + Use Playlet Remote in the browser + Use Playlet Remote in the browser + + + Link with Wi-Fi + Link with Wi-Fi + + + Link with TV code + Link with TV code + + + Cast from the YouTube app to Playlet + Cast from the YouTube app to Playlet + + + On your phone, connect to the same Wi-Fi network as this device. + On your phone, connect to the same Wi-Fi network as this device. + + + Open the YouTube app on your phone. + Open the YouTube app on your phone. + + + Tap the cast icon and select %1 + Tap the cast icon and select %1 + + + Roku connected to: + Roku connected to: + + + Wired connection + Wired connection + + + On your phone, open the YouTube app. + On your phone, open the YouTube app. + + + Tap the cast icon. + Tap the cast icon. + + + Tap 'Link with TV code' and enter the code below. + Tap 'Link with TV code' and enter the code below. + + + Loading... + Loading... + + + TV code error + TV code error + + + Failed to generate manual pairing code + Failed to generate manual pairing code + + + Playback + Playback + + + Playback preferences + Playback preferences + + + Autoplay + Autoplay + + + When you finish a video, another plays automatically + When you finish a video, another plays automatically + + + Preferred quality + Preferred quality + + + Preferred video quality + Preferred video quality + + + Auto (DASH) + Auto (DASH) + + + 720p + 720p + + + Medium + Medium + + + Invidious preferences + Invidious preferences + + + Instance + Instance + + + Invidious instance to use. Example: https://example.com + Invidious instance to use. Example: https://example.com + + + Proxy videos + Proxy videos + + + Proxy videos through the Invidious server. This is useful if videos are geoblocked. + Proxy videos through the Invidious server. This is useful if videos are geoblocked. + + + Always + Always + + + Only if needed + Only if needed + + + Never + Never + + + SponsorBlock + SponsorBlock + + + SponsorBlock preferences + SponsorBlock preferences + + + Enabled + Enabled + + + Enable SponsorBlock + Enable SponsorBlock + + + Show notifications + Show notifications + + + Show notifications when a segment is skipped + Show notifications when a segment is skipped + + + Search History + Search History + + + Search history preferences + Search history preferences + + + Enable search history + Enable search history + + + Clear Search History + Clear Search History + + + Clear search history from Playlet. This affects the search suggestions. This does not affect the watch history on Invidious. + Clear search history from Playlet. This affects the search suggestions. This does not affect the watch history on Invidious. + + + Search history cleared. + Search history cleared. + + + Miscellaneous + Miscellaneous + + + Misc. preferences + Misc. preferences + + + Edit home screen + Edit home screen + + + Enable/disable and reorder sections on the home screen + Enable/disable and reorder sections on the home screen + + + Queue notifications + Queue notifications + + + Show a notification when a video is added to the queue + Show a notification when a video is added to the queue + + + Developer + Developer + + + Developer preferences + Developer preferences + + + Use dev video player + Use dev video player + + + Enable the dev video player. This is an unfinished video player for testing purposes. + Enable the dev video player. This is an unfinished video player for testing purposes. + + + Playlet Library version + Playlet Library version + + + 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. + 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. + + + Press Options (*) for full screen + Press Options (*) for full screen + + + Video load error + Video load error + + + Failed to load video information for %1 + Failed to load video information for %1 + + + Error playing video %1 + Error playing video %1 + + + Error closing video + Error closing video + + + Request not sent. + Request not sent. + + + Request timed out. + Request timed out. + + + Request cancelled. + Request cancelled. + + + Reason + Reason + \ 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 ba77d3de..4589492b 100644 --- a/playlet-lib/src/locale/fr_CA/translations.ts +++ b/playlet-lib/src/locale/fr_CA/translations.ts @@ -153,6 +153,10 @@ Please note that an Invidious account is different from a YouTube account. Veuillez noter qu'un compte Invidious est différent d'un compte YouTube. + + Do you want to exit Playlet? + Voulez-vous quitter Playlet? + Invidious custom instance Instance personnalisée d'Invidious @@ -205,10 +209,18 @@ No Non + + Success + Succès + Refresh Rafraîchir + + Play next video + Lire la vidéo suivante + Test Test @@ -513,5 +525,285 @@ UPCOMING À VENIR + + You currently have no bookmarks. + Actuellement, vous n'avez aucun favori. + + + To add bookmarks, long-press 'OK' on a video, playlist or channel. + Pour ajouter des favoris, maintenez enfoncé le bouton 'OK' sur une vidéo, une playlist ou une chaîne. + + + Please note that Bookmarks is an experimental feature. + Veuillez noter que les favoris sont une fonctionnalité expérimentale. + + + Could not get IP address: are we connected to the internet? + Impossible d'obtenir l'adresse IP: est-on connecté à Internet? + + + Playlet Web App + Application Web Playlet + + + Use Playlet Remote in the browser + Controller Playlet depuis le navigateur + + + Link with Wi-Fi + Connecter avec Wi-Fi + + + Link with TV code + Connecter avec code TV + + + Cast from the YouTube app to Playlet + Diffusion depuis YouTube vers Playlet + + + On your phone, connect to the same Wi-Fi network as this device. + Sur votre téléphone, connectez-vous au même réseau Wi-Fi que cet appareil. + + + Open the YouTube app on your phone. + Ouvrez l'application YouTube sur votre téléphone. + + + Tap the cast icon and select %1 + Appuyez sur l'icône de diffusion et sélectionnez %1 + + + Roku connected to: + Roku connecté à : + + + Wired connection + Connexion filaire + + + On your phone, open the YouTube app. + Sur votre téléphone, ouvrez l'application YouTube. + + + Tap the cast icon. + Appuyez sur l'icône de diffusion. + + + Tap 'Link with TV code' and enter the code below. + Appuyez sur "Associer avec un code TV" et entrez le code ci-dessous. + + + Loading... + Chargement... + + + TV code error + Erreur de code TV + + + Failed to generate manual pairing code + Échec de la génération du code d'appariement manuel + + + Playback + Lecture + + + Playback preferences + Préférences de lecture + + + Autoplay + Lecture automatique + + + When you finish a video, another plays automatically + Lorsque vous avez terminé une vidéo, une autre se lance automatiquement + + + Preferred quality + Qualité préférée + + + Preferred video quality + Qualité vidéo préférée + + + Auto (DASH) + Auto (DASH) + + + 720p + 720p + + + Medium + Moyenne + + + Invidious preferences + Préférences Invidious + + + Instance + Instance + + + Invidious instance to use. Example: https://example.com + Instance Invidious à utiliser. Exemple: https://exemple.com + + + Proxy videos + Proxy vidéos + + + Proxy videos through the Invidious server. This is useful if videos are geoblocked. + Proxy vidéos à travers le serveur Invidious. Ceci est utile si les vidéos sont géobloquées. + + + Always + Toujours + + + Only if needed + Uniquement si nécessaire + + + Never + Jamais + + + SponsorBlock + SponsorBlock + + + SponsorBlock preferences + Préférences SponsorBlock + + + Enabled + Activé + + + Enable SponsorBlock + Activer SponsorBlock + + + Show notifications + Afficher les notifications + + + Show notifications when a segment is skipped + Afficher les notifications lorsqu'un segment est sauté + + + Search History + Historique de recherche + + + Search history preferences + Préférences de l'historique de recherche + + + Enable search history + Activer l'historique de recherche + + + Clear Search History + Effacer l'historique de recherche + + + Clear search history from Playlet. This affects the search suggestions. This does not affect the watch history on Invidious. + Effacer l'historique de recherche de Playlet. Cela affecte les suggestions de recherche. Cela n'affecte pas l'historique de visionnage sur Invidious. + + + Search history cleared. + Search history cleared. + + + Miscellaneous + Divers + + + Misc. preferences + Préférences diverses + + + Edit home screen + Modifier l'écran d'accueil + + + Enable/disable and reorder sections on the home screen + Activer/désactiver et réorganiser les sections sur l'écran d'accueil + + + Queue notifications + Notifications de file d'attente + + + Show a notification when a video is added to the queue + Afficher une notification lorsqu'une vidéo est ajoutée à la file d'attente + + + Developer + Développeur + + + Developer preferences + Préférences du développeur + + + Use dev video player + Utiliser le lecteur vidéo dev + + + Enable the dev video player. This is an unfinished video player for testing purposes. + Activer le lecteur vidéo de dev. Il s'agit d'un lecteur vidéo inachevé à des fins de test. + + + Playlet Library version + Version de Playlet Library + + + 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. + La version de Playlet Lib à utiliser. Celles-ci correspondent aux versions taguées sur Github. Les versions qui n'ont pas de fichier playlet-lib.zip sont désactivées. + + + Press Options (*) for full screen + Appuyez sur Options (*) pour plein écran + + + Video load error + Erreur de chargement de la vidéo + + + Failed to load video information for %1 + Échec du chargement des informations de la vidéo pour %1 + + + Error playing video %1 + Erreur de lecture de la vidéo %1 + + + Error closing video + Erreur lors de la fermeture de la vidéo + + + Request not sent. + Requête non envoyée. + + + Request timed out. + Requête expirée. + + + Request cancelled. + Requête annulée. + + + Reason + Raison + \ No newline at end of file diff --git a/playlet-lib/src/source/services/HttpClient.bs b/playlet-lib/src/source/services/HttpClient.bs index 0a78c0a4..bfadeec2 100644 --- a/playlet-lib/src/source/services/HttpClient.bs +++ b/playlet-lib/src/source/services/HttpClient.bs @@ -7,6 +7,7 @@ import "pkg:/source/utils/CryptoUtils.bs" import "pkg:/source/utils/ErrorUtils.bs" +import "pkg:/source/utils/Locale.bs" import "pkg:/source/utils/Logging.bs" import "pkg:/source/utils/StringUtils.bs" import "pkg:/source/utils/Types.bs" @@ -671,13 +672,13 @@ namespace HttpClient m._errorMessage = "" else if m.request._sent <> true - m._errorMessage = "Request not sent." + m._errorMessage = Tr(Locale.HttpClient.RequestNotSent) else if m.IsTimedOut() - m._errorMessage = "Request timed out." + m._errorMessage = Tr(Locale.HttpClient.RequestTimedOut) else if m.IsCancelled() - m._errorMessage = "Request cancelled." + m._errorMessage = Tr(Locale.HttpClient.RequestCancelled) else if type(m.event) = "roUrlEvent" - m._errorMessage = `Reason :${m.event.GetFailureReason() }\nStatusCode: ${m.StatusCode()}\nRequestId: ${m.event.GetSourceIdentity()}` + m._errorMessage = `${Tr(Locale.HttpClient.Reason)}:${m.event.GetFailureReason() }\nStatusCode: ${m.StatusCode()}\nRequestId: ${m.event.GetSourceIdentity()}` if includeBody m._errorMessage += `\nBody: ${m.event.GetString()}` end if diff --git a/playlet-lib/src/source/utils/Locale.bs b/playlet-lib/src/source/utils/Locale.bs index 916b0a5f..6acb15dc 100644 --- a/playlet-lib/src/source/utils/Locale.bs +++ b/playlet-lib/src/source/utils/Locale.bs @@ -30,6 +30,7 @@ namespace Locale MoveUp = "Move up" MoveDown = "Move down" Refresh = "Refresh" + PlayNextVideo = "Play next video" end enum @locale @@ -49,12 +50,13 @@ namespace Locale end enum @locale - enum LoginDialog + enum Dialogs LoginToInvidious = "Login to Invidious" IpAddressNotAvailable = "IP address not available" ScanTheQrCode = "Scan the QR code" LoginInstructions1 = "Login to Invidious in order to view Subscriptions, Playlists, and use the Watch history." LoginInstructions2 = "Please note that an Invidious account is different from a YouTube account." + ExitPlayletQuestion = "Do you want to exit Playlet?" end enum @locale @@ -71,9 +73,10 @@ namespace Locale end enum @locale - enum Genetic + enum Generic Yes = "Yes" No = "No" + Success = "Success" end enum @locale @@ -170,4 +173,105 @@ namespace Locale Upcoming = "UPCOMING" end enum + @locale + enum Bookmarks + 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." + end enum + + @locale + enum RemoteScreen + CouldNotGetIpAddress = "Could not get IP address: are we connected to the internet?" + + PlayletWebApp = "Playlet Web App" + UsePlayletRemoteInTheBrowser = "Use Playlet Remote in the browser" + LinkWithWiFi = "Link with Wi-Fi" + LinkWithTvCode = "Link with TV code" + CastFromYouTubeAppToPlaylet = "Cast from the YouTube app to Playlet" + + WifiInstruction1 = "On your phone, connect to the same Wi-Fi network as this device." + WifiInstruction2 = "Open the YouTube app on your phone." + WifiInstruction3 = "Tap the cast icon and select %1" + RokuConnectedTo = "Roku connected to:" + WiredConnection = "Wired connection" + + TvCodeInstruction1 = "On your phone, open the YouTube app." + TvCodeInstruction2 = "Tap the cast icon." + TvCodeInstruction3 = "Tap 'Link with TV code' and enter the code below." + Loading = "Loading..." + TvCodeError = "TV code error" + FailedToGeneratePairingCode = "Failed to generate manual pairing code" + end enum + + @locale + enum Settings + Playback = "Playback" + PlaybackPreferences = "Playback preferences" + Autoplay = "Autoplay" + AutoplayDescription = "When you finish a video, another plays automatically" + PreferredQuality = "Preferred quality" + PreferredQualityDescription = "Preferred video quality" + AutoDASH = "Auto (DASH)" + Seven20p = "720p" + Medium = "Medium" + + ' "Invidious" is used as node id, so we can't use it before refactoring node ids. + ' Either way, Invidious doesn't translate, so it's fine to skip it here + ' Invidious = "Invidious" + InvidiousPreferences = "Invidious preferences" + Instance = "Instance" + InstanceDescriptionTV = "Invidious instance to use. Example: https://example.com" + ProxyVideos = "Proxy videos" + ProxyVideosDescription = "Proxy videos through the Invidious server. This is useful if videos are geoblocked." + Always = "Always" + OnlyIfNeeded = "Only if needed" + Never = "Never" + + SponsorBlock = "SponsorBlock" + SponsorBlockPreferences = "SponsorBlock preferences" + Enabled = "Enabled" + EnabledDescription = "Enable SponsorBlock" + ShowNotifications = "Show notifications" + ShowNotificationsDescription = "Show notifications when a segment is skipped" + + SearchHistory = "Search History" + SearchHistoryPreferences = "Search history preferences" + EnableSearchHistory = "Enable 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." + + Miscellaneous = "Miscellaneous" + MiscellaneousPreferences = "Misc. preferences" + EditHomeScreen = "Edit home screen" + EditHomeScreenDescription = "Enable/disable and reorder sections on the home screen" + QueueNotifications = "Queue notifications" + QueueNotificationsDescription = "Show a notification when a video is added to the queue" + + Developer = "Developer" + DeveloperPreferences = "Developer preferences" + UseDevVideoPlayer = "Use dev video player" + UseDevVideoPlayerDescription = "Enable the dev video player. This is an unfinished video player for testing purposes." + PlayletLibraryVersion = "Playlet Library version" + PlayletLibraryVersionDescription = "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." + end enum + + @locale + enum VideoPlayer + FullScreenHint = "Press Options (*) for full screen" + VideoLoadError = "Video load error" + VideoLoadErrorMessage = "Failed to load video information for %1" + ErrorPlayingVideo = "Error playing video %1" + ErrorClosingVideo = "Error closing video" + end enum + + @locale + enum HttpClient + RequestNotSent = "Request not sent." + RequestTimedOut = "Request timed out." + RequestCancelled = "Request cancelled." + Reason = "Reason" + end enum + end namespace diff --git a/playlet-lib/src/source/utils/LocaleUtils.bs b/playlet-lib/src/source/utils/LocaleUtils.bs index 2aad94c3..663afa26 100644 --- a/playlet-lib/src/source/utils/LocaleUtils.bs +++ b/playlet-lib/src/source/utils/LocaleUtils.bs @@ -1,9 +1,13 @@ -' TODO:P2 Translations left -' - Some error messages -' - Settings file -' - Remote screen +' TODO:P2 Translations left: +' - Search filters ' - Web app ' - Loading messages +' - Video player +' - sponsorblock chapters +' - Queue +' - SponsorBlock notification +' - Device connected notification +' - Added to queue notification import "pkg:/source/utils/MathUtils.bs" diff --git a/tools/bs-plugins/locale-validation-plugin.ts b/tools/bs-plugins/locale-validation-plugin.ts index 9fc500f5..ea5dedef 100644 --- a/tools/bs-plugins/locale-validation-plugin.ts +++ b/tools/bs-plugins/locale-validation-plugin.ts @@ -25,7 +25,7 @@ import * as xml2js from 'xml2js'; import { globSync } from 'glob'; import { SGNode } from "brighterscript/dist/parser/SGTypes"; -const allowedXmlAttributes = ["text", "title", "primaryTitle"]; +const allowedXmlAttributes = ["text", "title", "primaryTitle", "displayText", "description"]; export class LocaleValidationPlugin implements CompilerPlugin { public name = 'LocaleValidationPlugin'; @@ -68,7 +68,7 @@ export class LocaleValidationPlugin implements CompilerPlugin { file.addDiagnostics([{ file: file, range: field.range!, - message: `Locale value found in xml component: ${value}.`, + message: `Locale value found in xml component "${value}" but the attribute "${id}" is not allowed to be localized.`, severity: DiagnosticSeverity.Error, code: 'LOCALE_VALUE_IN_XML', }]); @@ -93,7 +93,7 @@ export class LocaleValidationPlugin implements CompilerPlugin { file.addDiagnostics([{ file: file, range: attribute.value.range!, - message: `Locale value found in xml component: ${value}.`, + message: `Locale value found in xml component: "${value}" but the attribute "${key}" is not allowed to be localized.`, severity: DiagnosticSeverity.Error, code: 'LOCALE_VALUE_IN_XML', }]);