diff --git a/assets/jsons/translations/en-EN.json b/assets/jsons/translations/en-EN.json index 6fa05732..c9aa9b1c 100644 --- a/assets/jsons/translations/en-EN.json +++ b/assets/jsons/translations/en-EN.json @@ -20,7 +20,8 @@ } }, "available-versions":{ - "title": "Select a version" + "title": "Select a version", + "steam-release":"Release page" }, "settings":{ "steam":{ @@ -61,5 +62,95 @@ } } } + }, + "notifications":{ + "types":{ + "error": "🚨 Error", + "warning": "⚠️ Warning", + "success": "🎉 Success" + }, + "bs-download":{ + "success":{ + "titles":{ + "download-success": "Download complete", + "verification-finished":"Verification complete" + } + }, + "warnings":{ + "msg":{ + "ManifestChecksum": "The previously downloaded manifest does not match the new 🤔", + "ConnectionTimeout": "Your internet connection seems unstable 🥶", + "Unknown": "Something strange has happened 🤔 Your connection is probably unstable." + } + }, + "errors":{ + "titles":{ + "verification-failed":"The verification failed." + }, + "msg":{ + "Password": "Password is invalid.", + "InvalidCredentials": "Your e-mail or password is invalid 😴", + "NoManifest": "No manifest was found", + "DirectoryCreate": "Unable to install the necessary folders.", + "NotAvailableApp": "Are you trying to download BeatSaber when you don't have it ? 🤣", + "DepotNotFound": "Unable to download BeatSaber 😥 try again later 😕", + "NotCompleted": "The download could not complete ¯\\_(ツ)_/¯", + "InvalidManifest": "Unable to download BeatSaber 😥 try again later 😕", + "NoValidKey": "Unable to download BeatSaber 😥 try again later 😕", + "NoManifestCode": "Unable to download BeatSaber 😥 try again later 😕", + "401": "Steam doesn't seem to want to let us download BeatSaber 😢", + "404": "Unable to contact Steam servers.", + "Unknown": "An unknown error occurred ¯\\_(ツ)_/¯", + "NoServer": "Unable to contact Steam servers.", + "NotAllowed": "Apparently you are not allowed to download BeatSaber 🥱", + "ConnectionTimeout": "Cannot connect to Steam 😕", + "SteamLib": "If you have this error, report the bug on GitHub with the logs pls.", + "ConnectionError": "Unable to connect to Steam after 10 tries 🤯", + "LicenceError": "Unable to get the list of licenses.", + "verification-failed": "Verification failed, try again later." + } + } + }, + "settings":{ + "move-folder":{ + "success":{ + "titles":{ + "transfer-finished":"Transfer complete" + } + }, + "errors":{ + "titles":{ + "transfer-failed":"Transfer failed 😕" + } + } + }, + "steam":{ + "success":{ + "titles":{ + "logout": "Disconnected from Steam." + } + } + } + }, + "bs-launch":{ + "success":{ + "titles":{ + "launching": "Launching...🚀" + } + }, + "errors":{ + "titles":{ + "UNABLE_TO_LAUNCH": "Unable to launch", + "STEAM_NOT_RUNNING": "Steam is not running", + "BS_ALREADY_RUNNING": "BeatSaber already running", + "EXE_NOT_FINDED": "Missing files" + }, + "msg":{ + "STEAM_NOT_RUNNING": "Steam must be running to launch BeatSaber.", + "BS_ALREADY_RUNNING": "Close BeatSaber before launching it again.", + "EXE_NOT_FINDED": "Some files seem to be missing, try to verify the files." + } + } + } } } \ No newline at end of file diff --git a/assets/jsons/translations/en-US.json b/assets/jsons/translations/en-US.json index c36aad01..c9aa9b1c 100644 --- a/assets/jsons/translations/en-US.json +++ b/assets/jsons/translations/en-US.json @@ -20,7 +20,8 @@ } }, "available-versions":{ - "title": "Select a version" + "title": "Select a version", + "steam-release":"Release page" }, "settings":{ "steam":{ @@ -30,7 +31,7 @@ }, "appearance":{ "title":"Appearance", - "description":"Choose the two main colors of BSManager.", + "description":"Choose the two main colours of BSManager.", "reset":"Reset", "sub-title":"Theme", "themes":{ @@ -46,7 +47,7 @@ }, "language":{ "title":"Language", - "description":"Selects a language.", + "description":"Select a language.", "languages":{ "en-EN": "English, UK", "en-US": "English, US", @@ -54,11 +55,101 @@ "es-ES": "Español", "translated":{ "en-EN": "English, United Kingdom", - "en-US": "English, United States", + "en-US": "English, USA", "fr-FR": "French", "es-ES": "Spanish" } } + } + } + }, + "notifications":{ + "types":{ + "error": "🚨 Error", + "warning": "⚠️ Warning", + "success": "🎉 Success" + }, + "bs-download":{ + "success":{ + "titles":{ + "download-success": "Download complete", + "verification-finished":"Verification complete" + } + }, + "warnings":{ + "msg":{ + "ManifestChecksum": "The previously downloaded manifest does not match the new 🤔", + "ConnectionTimeout": "Your internet connection seems unstable 🥶", + "Unknown": "Something strange has happened 🤔 Your connection is probably unstable." + } + }, + "errors":{ + "titles":{ + "verification-failed":"The verification failed." + }, + "msg":{ + "Password": "Password is invalid.", + "InvalidCredentials": "Your e-mail or password is invalid 😴", + "NoManifest": "No manifest was found", + "DirectoryCreate": "Unable to install the necessary folders.", + "NotAvailableApp": "Are you trying to download BeatSaber when you don't have it ? 🤣", + "DepotNotFound": "Unable to download BeatSaber 😥 try again later 😕", + "NotCompleted": "The download could not complete ¯\\_(ツ)_/¯", + "InvalidManifest": "Unable to download BeatSaber 😥 try again later 😕", + "NoValidKey": "Unable to download BeatSaber 😥 try again later 😕", + "NoManifestCode": "Unable to download BeatSaber 😥 try again later 😕", + "401": "Steam doesn't seem to want to let us download BeatSaber 😢", + "404": "Unable to contact Steam servers.", + "Unknown": "An unknown error occurred ¯\\_(ツ)_/¯", + "NoServer": "Unable to contact Steam servers.", + "NotAllowed": "Apparently you are not allowed to download BeatSaber 🥱", + "ConnectionTimeout": "Cannot connect to Steam 😕", + "SteamLib": "If you have this error, report the bug on GitHub with the logs pls.", + "ConnectionError": "Unable to connect to Steam after 10 tries 🤯", + "LicenceError": "Unable to get the list of licenses.", + "verification-failed": "Verification failed, try again later." + } + } + }, + "settings":{ + "move-folder":{ + "success":{ + "titles":{ + "transfer-finished":"Transfer complete" + } + }, + "errors":{ + "titles":{ + "transfer-failed":"Transfer failed 😕" + } + } + }, + "steam":{ + "success":{ + "titles":{ + "logout": "Disconnected from Steam." + } + } + } + }, + "bs-launch":{ + "success":{ + "titles":{ + "launching": "Launching...🚀" + } + }, + "errors":{ + "titles":{ + "UNABLE_TO_LAUNCH": "Unable to launch", + "STEAM_NOT_RUNNING": "Steam is not running", + "BS_ALREADY_RUNNING": "BeatSaber already running", + "EXE_NOT_FINDED": "Missing files" + }, + "msg":{ + "STEAM_NOT_RUNNING": "Steam must be running to launch BeatSaber.", + "BS_ALREADY_RUNNING": "Close BeatSaber before launching it again.", + "EXE_NOT_FINDED": "Some files seem to be missing, try to verify the files." + } } } } diff --git a/assets/jsons/translations/es-ES.json b/assets/jsons/translations/es-ES.json index 345c3911..e7778b80 100644 --- a/assets/jsons/translations/es-ES.json +++ b/assets/jsons/translations/es-ES.json @@ -20,7 +20,8 @@ } }, "available-versions":{ - "title": "Seleccione una versión" + "title": "Seleccione una versión", + "steam-release":"Publicación Página" }, "settings":{ "steam":{ @@ -61,5 +62,96 @@ } } } - } + }, + + "notifications":{ + "types":{ + "error": "🚨 Error", + "warning": "⚠️ Advertencia", + "success": "🎉 Éxito" + }, + "bs-download":{ + "success":{ + "titles":{ + "download-success": "Descargar completo", + "verification-finished":"Verificación completa" + } + }, + "warnings":{ + "msg":{ + "ManifestChecksum": "El manifiesto descargado anteriormente no coincide con el nuevo 🤔", + "ConnectionTimeout": "Su conexión a Internet parece inestable 🥶", + "Unknown": "Algo extraño ha ocurrido 🤔 Tu conexión es probablemente inestable." + } + }, + "errors":{ + "titles":{ + "verification-failed":"La verificación falló." + }, + "msg":{ + "Password": "La contraseña es inválida.", + "InvalidCredentials": "Su correo electrónico o contraseña no son válidos 😴", + "NoManifest": "No se ha encontrado el manifiesto", + "DirectoryCreate": "No se pueden instalar las carpetas necesarias.", + "NotAvailableApp": "¿Intentas descargar BeatSaber cuando no lo tienes? 🤣", + "DepotNotFound": "No se puede descargar BeatSaber 😥 inténtalo más tarde 😕", + "NotCompleted": "La descarga no pudo completarse ¯\\_(ツ)_/¯", + "InvalidManifest": "No se puede descargar BeatSaber 😥 inténtalo más tarde 😕", + "NoValidKey": "No se puede descargar BeatSaber 😥 inténtalo más tarde 😕", + "NoManifestCode": "No se puede descargar BeatSaber 😥 inténtalo más tarde 😕", + "401": "Parece que Steam no quiere dejarnos descargar BeatSaber 😢", + "404": "No se puede contactar con los servidores de Steam", + "Unknown": "Se ha producido un error desconocido ¯\\_(ツ)_/¯", + "NoServer": "No se puede contactar con los servidores de Steam.", + "NotAllowed": "Aparentemente no tienes permiso para descargar BeatSaber 🥱", + "ConnectionTimeout": "No se puede conectar a Steam 😕", + "SteamLib": "Si tienes este error, reporta el bug en GitHub con los logs por favor.", + "ConnectionError": "No se puede conectar a Steam después de 10 intentos 🤯", + "LicenceError": "No se puede obtener la lista de licencias.", + "verification-failed": "Verificación fallida, inténtelo más tarde." + } + } + }, + "settings":{ + "move-folder":{ + "success":{ + "titles":{ + "transfer-finished":"Transferencia completa" + } + }, + "errors":{ + "titles":{ + "transfer-failed":"Transferencia fallida 😕" + } + } + }, + "steam":{ + "success":{ + "titles":{ + "logout": "Desconectado de Steam." + } + } + } + }, + "bs-launch":{ + "success":{ + "titles":{ + "launching": "Lanzamiento...🚀" + } + }, + "errors":{ + "titles":{ + "UNABLE_TO_LAUNCH": "No se puede lanzar", + "STEAM_NOT_RUNNING": "Steam no funciona", + "BS_ALREADY_RUNNING": "BeatSaber ya está en marcha", + "EXE_NOT_FINDED": "Archivos perdidos" + }, + "msg":{ + "STEAM_NOT_RUNNING": "Para iniciar BeatSaber es necesario que Steam esté en funcionamiento.", + "BS_ALREADY_RUNNING": "Cierra BeatSaber antes de volver a lanzarlo.", + "EXE_NOT_FINDED": "Parece que faltan algunos archivos, intente verificar los archivos." + } + } + } + } } diff --git a/assets/jsons/translations/fr-FR.json b/assets/jsons/translations/fr-FR.json index 72505cce..0f1877c1 100644 --- a/assets/jsons/translations/fr-FR.json +++ b/assets/jsons/translations/fr-FR.json @@ -20,7 +20,8 @@ } }, "available-versions":{ - "title": "Choisi une version" + "title": "Choisi une version", + "steam-release":"Notes de version" }, "settings":{ "steam":{ @@ -61,5 +62,95 @@ } } } + }, + "notifications":{ + "types":{ + "error": "🚨 Erreur", + "warning": "⚠️ Attention", + "success": "🎉 Succès" + }, + "bs-download":{ + "success":{ + "titles":{ + "download-success": "Téléchargement terminé", + "verification-finished":"Vérification terminée" + } + }, + "warnings":{ + "msg":{ + "ManifestChecksum": "Le manifest télécharger précédemment ne correspond pas au nouveau 🤔", + "ConnectionTimeout": "Ta connexion internet semble instable 🥶", + "Unknown": "Quelque chose d'étrange c'est produit 🤔 Votre connexion est surement instable." + } + }, + "errors":{ + "titles":{ + "verification-failed":"La vérification a échoué." + }, + "msg":{ + "Password": "Le mot de passe est invalide.", + "InvalidCredentials": "Ton e-mail ou mot de passe est invalide 😴", + "NoManifest": "Aucun manifest n'a été trouvé.", + "DirectoryCreate": "Impossible d'installer les dossiers nécessaires.", + "NotAvailableApp": "Tu essayes de télécharger BeatSaber alors que tu ne l'as pas ? 🤣", + "DepotNotFound": "Impossible de télécharger BeatSaber 😥 réessaye plus tard 😕", + "NotCompleted": "Le téléchargement n'a pas pu se terminer ¯\\_(ツ)_/¯", + "InvalidManifest": "Impossible de télécharger BeatSaber 😥 réessaye plus tard 😕", + "NoValidKey": "Impossible de télécharger BeatSaber 😥 réessaye plus tard 😕", + "NoManifestCode": "Impossible de télécharger BeatSaber 😥 réessaye plus tard 😕", + "401": "Steam semble pas vouloir nous laisser télécharger BeatSaber 😢", + "404": "Impossible de contacter les serveurs de Steam.", + "Unknown": "Une erreur inconnue c'est produite ¯\\_(ツ)_/¯", + "NoServer": "Impossible de contacter les serveurs de Steam.", + "NotAllowed": "Apparemment tu n'es pas autorisé à télécharger BeatSaber 🥱", + "ConnectionTimeout": "Impossible de se connecter à Steam 😕", + "SteamLib": "Si tu à cette erreur, report le bug sur GitHub avec les logs stp.", + "ConnectionError": "Impossible de se connecter à Steam après 10 essais 🤯", + "LicenceError": "Impossible d'obtenir la liste des licences.", + "verification-failed": "La vérification a échoué, réessaye plus tard." + } + } + }, + "settings":{ + "move-folder":{ + "success":{ + "titles":{ + "transfer-finished":"Transfert terminé 👌" + } + }, + "errors":{ + "titles":{ + "transfer-failed":"Le transfert a échoué 😕" + } + } + }, + "steam":{ + "success":{ + "titles":{ + "logout": "Déconnecté de Steam." + } + } + } + }, + "bs-launch":{ + "success":{ + "titles":{ + "launching": "Lancement...🚀" + } + }, + "errors":{ + "titles":{ + "UNABLE_TO_LAUNCH": "Lancement impossible", + "STEAM_NOT_RUNNING": "Steam n'est pas lancé", + "BS_ALREADY_RUNNING": "BeatSaber est déjà lancé", + "EXE_NOT_FINDED": "Fichiers manquants" + }, + "msg":{ + "STEAM_NOT_RUNNING": "Steam doit être en cours d'exécution pour lancer BeatSaber.", + "BS_ALREADY_RUNNING": "Ferme BeatSaber avant de le lancer à nouveau.", + "EXE_NOT_FINDED": "Quelques fichiers semblent manquants. Essaye de vérifier les fichiers." + } + } + } } } diff --git a/src/main/ipcs/bs-download-ipcs.ts b/src/main/ipcs/bs-download-ipcs.ts index f5735028..65167fdc 100644 --- a/src/main/ipcs/bs-download-ipcs.ts +++ b/src/main/ipcs/bs-download-ipcs.ts @@ -47,7 +47,7 @@ ipcMain.on('bs-download.set-installation-folder', (event, request: IpcRequest { console.log(err); - UtilsService.getInstance().newIpcSenc(request.responceChannel, {success: false, error: err}); + UtilsService.getInstance().newIpcSenc(request.responceChannel, {success: false, error: {title: err, type: 'error'}}); }); }) diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx index c8b61ef6..f489e7b8 100644 --- a/src/renderer/App.tsx +++ b/src/renderer/App.tsx @@ -25,13 +25,13 @@ export default function App() { else { document.documentElement.classList.remove('dark'); } }); - bsDownloadService.downloadWarning$.pipe(filter(v => !!v), distinctUntilChanged(), debounceTime(100)).subscribe(() => { - notificationService.notifyWarning({title: "Warning", desc: "Your connection seems unstable"}); + bsDownloadService.downloadWarning$.pipe(filter(v => !!v), distinctUntilChanged(), debounceTime(100)).subscribe((warning) => { + notificationService.notifyWarning({title: "notifications.types.warning", desc: `notifications.bs-download.warnings.msg.${warning}`}); }); bsDownloadService.downloadError$.pipe(filter(v => !!v), distinctUntilChanged(), debounceTime(100)).subscribe(err => { - notificationService.notifyError({title: "Error", desc: err}); - }) + notificationService.notifyError({title: "notifications.types.error", desc: `notifications.bs-download.errors.msg.${err}`}); + }); }, []) diff --git a/src/renderer/components/available-versions/available-version-item.component.tsx b/src/renderer/components/available-versions/available-version-item.component.tsx index cb8ecf95..fea4a672 100644 --- a/src/renderer/components/available-versions/available-version-item.component.tsx +++ b/src/renderer/components/available-versions/available-version-item.component.tsx @@ -8,6 +8,7 @@ import defaultImage from '../../../../assets/images/default-version-img.jpg' import dateFormat from "dateformat"; import { BsmImage } from "../shared/bsm-image.component"; import { IpcService } from "renderer/services/ipc.service"; +import { useTranslation } from "renderer/hooks/use-translation.hook"; export const AvailableVersionItem = memo(function AvailableVersionItem(props: {version: BSVersion}) { @@ -15,6 +16,7 @@ export const AvailableVersionItem = memo(function AvailableVersionItem(props: {v const ipcService = IpcService.getInstance(); const [selected, setSelected] = useState(false); + const t = useTranslation(); const formatedDate = (() => { return dateFormat(+props.version.ReleaseDate*1000, "ddd. dS mmm yyyy"); })() @@ -50,7 +52,7 @@ export const AvailableVersionItem = memo(function AvailableVersionItem(props: {v { props.version.ReleaseURL && ( { e.stopPropagation(); openReleasePage(); }} className="relative flex flex-row justify-between items-center rounded-full bg-black bg-opacity-30 text-white pb-[1px] hover:bg-opacity-50"> - Release Page + {t("pages.available-versions.steam-release")} )} diff --git a/src/renderer/components/notification/notification-item.component.tsx b/src/renderer/components/notification/notification-item.component.tsx index e84c8270..6bc65ae2 100644 --- a/src/renderer/components/notification/notification-item.component.tsx +++ b/src/renderer/components/notification/notification-item.component.tsx @@ -6,41 +6,44 @@ import BeatConflictImg from "../../../../assets/images/apngs/beat-conflict.png"; import BeatWaitingImg from "../../../../assets/images/apngs/beat-waiting.png"; import BeatImpatientImg from "../../../../assets/images/apngs/beat-impatient.png"; import { BsmButton } from "../shared/bsm-button.component"; +import { useTranslation } from "renderer/hooks/use-translation.hook"; export function NotificationItem({resolver, notification}: {resolver?: (value: NotificationResult|string) => void, notification: Notification}) { - const renderImage = () => { - if(notification.type === NotificationType.SUCCESS){ return BeatRunningImg; } - if(notification.type === NotificationType.WARNING){ return BeatWaitingImg; } - if(notification.type === NotificationType.ERROR){ return BeatConflictImg; } - return BeatImpatientImg; - } + const t = useTranslation(); - const renderNeonColors = () => { - if(notification.type === NotificationType.SUCCESS){ return "bg-green-400 shadow-green-400"; } - if(notification.type === NotificationType.WARNING){ return "bg-yellow-400 shadow-yellow-400"; } - if(notification.type === NotificationType.ERROR){ return "bg-red-500 shadow-red-500"; } - return "bg-gray-800 shadow-gray-800 dark:bg-white dark:shadow-white"; - } + const renderImage = () => { + if(notification.type === NotificationType.SUCCESS){ return BeatRunningImg; } + if(notification.type === NotificationType.WARNING){ return BeatWaitingImg; } + if(notification.type === NotificationType.ERROR){ return BeatConflictImg; } + return BeatImpatientImg; + } + + const renderNeonColors = () => { + if(notification.type === NotificationType.SUCCESS){ return "bg-green-400 shadow-green-400"; } + if(notification.type === NotificationType.WARNING){ return "bg-yellow-400 shadow-yellow-400"; } + if(notification.type === NotificationType.ERROR){ return "bg-red-500 shadow-red-500"; } + return "bg-gray-800 shadow-gray-800 dark:bg-white dark:shadow-white"; + } return ( - -
-
- -
-

{notification.title}

- {notification.desc &&

{notification.desc}

} -
+ +
+
+ +
+

{t(notification.title)}

+ {notification.desc &&

{t(notification.desc)}

}
- {notification.actions && ( -
- {notification.actions.map(a => resolver(a.id)} className={`px-1 cursor-pointer flex-1 grow rounded-md text-center bg-blue-500 hover:brightness-110 transition-all text-gray-200 whitespace-nowrap m-[3px] ${a.cancel && "!bg-gray-500"}`}>{a.title})} -
- )} -
- - resolver(NotificationResult.CLOSE)}/> - +
+ {notification.actions && ( +
+ {notification.actions.map(a => resolver(a.id)} className={`px-1 cursor-pointer flex-1 grow rounded-md text-center bg-blue-500 hover:brightness-110 transition-all text-gray-200 whitespace-nowrap m-[3px] ${a.cancel && "!bg-gray-500"}`}>{t(a.title)})} +
+ )} +
+ + resolver(NotificationResult.CLOSE)}/> + ) } diff --git a/src/renderer/hooks/use-translation.hook.ts b/src/renderer/hooks/use-translation.hook.ts index 7403516f..1474feb2 100644 --- a/src/renderer/hooks/use-translation.hook.ts +++ b/src/renderer/hooks/use-translation.hook.ts @@ -5,6 +5,7 @@ export function useTranslation(): (translationKey: string) => string{ const i18nService = I18nService.getInstance(); return (key: string) => { + if(!key){ return ""; } const tranlatables = key.split(" "); return tranlatables.map((key) => i18nService.translate(key)).join(" "); } diff --git a/src/renderer/pages/available-versions-list.components.tsx b/src/renderer/pages/available-versions-list.components.tsx index d519c9ea..a97aaa72 100644 --- a/src/renderer/pages/available-versions-list.components.tsx +++ b/src/renderer/pages/available-versions-list.components.tsx @@ -38,7 +38,7 @@ export function AvailableVersionsList() { progressBarService.hide(true); if(res.success){ - notificationService.notifySuccess({title: 'Download Complete', duration: 3000}); + notificationService.notifySuccess({title: "notifications.bs-download.success.titles.download-success", duration: 3000}); } }); } diff --git a/src/renderer/pages/settings-page.component.tsx b/src/renderer/pages/settings-page.component.tsx index 3d95a533..c4ec6b71 100644 --- a/src/renderer/pages/settings-page.component.tsx +++ b/src/renderer/pages/settings-page.component.tsx @@ -75,31 +75,34 @@ export function SettingsPage() { } const setDefaultInstallationFolder = () => { - modalService.openModal(ModalType.INSTALLATION_FOLDER).then(async res => { - if(res.exitCode !== ModalExitCode.COMPLETED){ return; } - const fileChooserRes = await ipcService.send<{canceled: boolean, filePaths: string[]}>("choose-folder"); + modalService.openModal(ModalType.INSTALLATION_FOLDER).then(async res => { + if(res.exitCode !== ModalExitCode.COMPLETED){ return; } + const fileChooserRes = await ipcService.send<{canceled: boolean, filePaths: string[]}>("choose-folder"); - if(fileChooserRes.success && !fileChooserRes.data.canceled && fileChooserRes.data.filePaths?.length){ - progressBarService.showFake(.008); - downloaderService.setInstallationFolder(fileChooserRes.data.filePaths[0]).then(res => { - setTimeout(() => { - progressBarService.complete(); - setTimeout(() => progressBarService.hide(true), 1000); - }, 1000); - if(res.success){ - setInstallationFolder(res.data); - notificationService.notifySuccess({title: "Transfer completed", duration: 3000}); - } - }); - } + if(fileChooserRes.success && !fileChooserRes.data.canceled && fileChooserRes.data.filePaths?.length){ + progressBarService.showFake(.008); + downloaderService.setInstallationFolder(fileChooserRes.data.filePaths[0]).then(res => { + setTimeout(() => { + progressBarService.complete(); + setTimeout(() => progressBarService.hide(true), 1000); + }, 1000); + if(res.success){ + setInstallationFolder(res.data); + notificationService.notifySuccess({title: "notifications.settings.move-folder.success.titles.transfer-finished", duration: 3000}); + } + else{ + notificationService.notifyError({title: "notifications.settings.move-folder.errors.titles.transfer-failed", desc: res?.error?.title}); + } + }); + } - }) - } + }); + } const deleteSteamSession = () => { if(!sessionExist){ return; } authService.deleteSteamSession(); - notificationService.notifySuccess({title: "Disconnected from Steam", duration: 3000}); + notificationService.notifySuccess({title: "notifications.settings.steam.success.titles.logout", duration: 3000}); }; return ( diff --git a/src/renderer/pages/version-viewer.component.tsx b/src/renderer/pages/version-viewer.component.tsx index c53ae223..8dc772b8 100644 --- a/src/renderer/pages/version-viewer.component.tsx +++ b/src/renderer/pages/version-viewer.component.tsx @@ -73,6 +73,9 @@ export function VersionViewer() { .catch((e) => {console.log("*** ", e)}) } } + else if(id === 2){ + verifyFiles(); + } else if(id === 1){ window.electron.ipcRenderer.sendMessage("bs-version.open-folder", state); } @@ -82,23 +85,23 @@ export function VersionViewer() { progressService.show(bsDownloaderService.downloadProgress$); bsDownloaderService.download(state).then(res => { progressService.hide(true); - if(!res.success){ notificationService.notifyError({title: "Unable to verify", desc: "Unable to verify, please try later"}); } - else(notificationService.notifySuccess({title: "Verification complete"})); + if(!res.success){ notificationService.notifyError({title: "notifications.bs-download.errors.titles.verification-failed", desc: "notifications.bs-download.errors.msg.verification-failed"}); } + else(notificationService.notifySuccess({title: "notifications.bs-download.success.titles.verification-finished"})); }) } const launchBs = () => { bsLauncherService.launch(state, oculusMode, desktopMode, debugMode).then(res => { - if(!res.success){ notificationService.notifyError({title: 'Unable to launch', desc: res.error.title}); } - else if(res.data === "STEAM_NOT_RUNNING"){ notificationService.notifyWarning({title: "Steam not running", desc: "Steam must be running to launch Beat Saber."}); } - else if(res.data === "BS_ALREADY_RUNNING"){ notificationService.notifyWarning({title: "Beat Saber already running", desc: "Please close Beat Saber to launch."}); } + if(!res.success){ notificationService.notifyError({title: "notifications.bs-launch.errors.titles.UNABLE_TO_LAUNCH", desc: res.error.title}); } + else if(res.data === "STEAM_NOT_RUNNING"){ notificationService.notifyError({title: "notifications.bs-launch.errors.titles.STEAM_NOT_RUNNING", desc: "notifications.bs-launch.errors.msg.STEAM_NOT_RUNNING"}); } + else if(res.data === "BS_ALREADY_RUNNING"){ notificationService.notifyError({title: "notifications.bs-launch.errors.titles.UNABLE_TO_LAUNCH", desc: "notifications.bs-launch.errors.msg.UNABLE_TO_LAUNCH"}); } else if(res.data === "EXE_NOT_FINDED"){ - notificationService.notifyError({title: "Files missing", desc: "Some files are missing, please verify the download", actions: [{id: "0", title:"Verfiy"}]}).then(res => { + notificationService.notifyError({title: "notifications.bs-launch.errors.titles.EXE_NOT_FINDED", desc: "notifications.bs-launch.errors.msg.EXE_NOT_FINDED", actions: [{id: "0", title:"misc.verify"}]}).then(res => { if(res !== "0"){ return; } verifyFiles(); }); } - else if(res.data === "LAUNCHED"){ notificationService.notifySuccess({title: "Launching..."}) } + else if(res.data === "LAUNCHED"){ notificationService.notifySuccess({title: "notifications.bs-launch.success.titles.launching"}) } else(notificationService.notifyError({title: res.data || res.error.title})); }); } diff --git a/src/renderer/services/i18n.service.ts b/src/renderer/services/i18n.service.ts index 81deb10c..35c12609 100644 --- a/src/renderer/services/i18n.service.ts +++ b/src/renderer/services/i18n.service.ts @@ -47,7 +47,6 @@ export class I18nService { public translate(translationKey: string): string{ const cachedTranlation = this.cache.get(translationKey); if(!!cachedTranlation){ return cachedTranlation; } - console.log(translationKey); const tranlated = getProperty(this.dictionary, translationKey); tranlated && this.cache.set(translationKey, tranlated); return tranlated || translationKey;