fix: fixing translations and typescript renderer errors

This commit is contained in:
Hydra 2024-05-04 18:25:19 +01:00
parent 22633ba45f
commit 0a597acd26
12 changed files with 90 additions and 49 deletions

View File

@ -15,9 +15,12 @@
"checking_files": "{{title}} ({{percentage}} - Analizando archivos…)", "checking_files": "{{title}} ({{percentage}} - Analizando archivos…)",
"paused": "{{title}} (Pausado)", "paused": "{{title}} (Pausado)",
"downloading": "{{title}} ({{percentage}} - Descargando…)", "downloading": "{{title}} ({{percentage}} - Descargando…)",
"filter": "Filtrar biblioteca", "filter": "Buscar en la biblioteca",
"follow_us": "Síguenos",
"home": "Inicio", "home": "Inicio",
"follow_us": "Síguenos" "discord": "Únete a nuestro Discord",
"x": "Síguenos en X",
"github": "Contribuye en GitHub"
}, },
"header": { "header": {
"search": "Buscar", "search": "Buscar",
@ -45,7 +48,7 @@
"remove": "Eliminar", "remove": "Eliminar",
"remove_from_list": "Quitar", "remove_from_list": "Quitar",
"space_left_on_disk": "{{space}} restantes en el disco", "space_left_on_disk": "{{space}} restantes en el disco",
"eta": "Finalizando {{eta}}", "eta": "Finalizando en {{eta}}",
"downloading_metadata": "Descargando metadatos…", "downloading_metadata": "Descargando metadatos…",
"checking_files": "Analizando archivos…", "checking_files": "Analizando archivos…",
"filter": "Filtrar repacks", "filter": "Filtrar repacks",
@ -55,14 +58,12 @@
"no_minimum_requirements": "Sin requisitos mínimos para {{title}}", "no_minimum_requirements": "Sin requisitos mínimos para {{title}}",
"no_recommended_requirements": "{{title}} no tiene requisitos recomendados", "no_recommended_requirements": "{{title}} no tiene requisitos recomendados",
"paused_progress": "{{progress}} (Pausado)", "paused_progress": "{{progress}} (Pausado)",
"release_date": "Fecha de lanzamiento {{date}}", "release_date": "Fecha de lanzamiento: {{date}}",
"publisher": "Publicado por {{publisher}}", "publisher": "Publicado por: {{publisher}}",
"copy_link_to_clipboard": "Copiar enlace", "copy_link_to_clipboard": "Copiar enlace",
"copied_link_to_clipboard": "Enlace copiado", "copied_link_to_clipboard": "Enlace copiado",
"hours": "horas", "hours": "horas",
"minutes": "minutos", "minutes": "minutos",
"amount_hours": "{{amount}} horas",
"amount_minutes": "{{amount}} minutos",
"accuracy": "{{accuracy}}% precisión", "accuracy": "{{accuracy}}% precisión",
"add_to_library": "Agregar a la biblioteca", "add_to_library": "Agregar a la biblioteca",
"remove_from_library": "Eliminar de la biblioteca", "remove_from_library": "Eliminar de la biblioteca",
@ -75,7 +76,21 @@
"close": "Cerrar", "close": "Cerrar",
"deleting": "Eliminando instalador…", "deleting": "Eliminando instalador…",
"playing_now": "Jugando ahora", "playing_now": "Jugando ahora",
"last_time_played": "Jugado por última vez {{period}}" "last_time_played": "Jugado por última vez {{period}}",
"got_it": "Entendido",
"change": "Cambiar",
"repacks_modal_description": "Selecciona el repack que quieres descargar",
"downloads_path": "Ruta de descarga",
"select_folder_hint": "Para cambiar la carpeta predeterminada, accede a",
"settings": "Ajustes",
"download_now": "Descargar ahora",
"installation_instructions": "Instrucciones de instalación",
"installation_instructions_description": "Se requieren de pasos adicionales para instalar este juego",
"online_fix_instruction": "Los juegos de OnlineFix requieren una contraseña para ser extraídos. Cuando se requiera, usa la siguiente contraseña:",
"dodi_installation_instruction": "Cuando abras el instalador de DODI, presiona la tecla hacia arriba del teclado <0 /> para iniciar el proceso de instalación:",
"dont_show_it_again": "No mostrar de nuevo",
"copy_to_clipboard": "Copiar",
"copied_to_clipboard": "Copiado"
}, },
"activation": { "activation": {
"title": "Activar Hydra", "title": "Activar Hydra",
@ -88,7 +103,7 @@
"downloads": { "downloads": {
"resume": "Resumir", "resume": "Resumir",
"pause": "Pausa", "pause": "Pausa",
"eta": "Finalizando {{eta}}", "eta": "Finalizando en {{eta}}",
"paused": "En Pausa", "paused": "En Pausa",
"verifying": "Verificando…", "verifying": "Verificando…",
"completed_at": "Completado el {{date}}", "completed_at": "Completado el {{date}}",
@ -103,8 +118,8 @@
"starting_download": "Iniciando descarga…", "starting_download": "Iniciando descarga…",
"remove_from_list": "Eliminar", "remove_from_list": "Eliminar",
"delete": "Eliminar instalador", "delete": "Eliminar instalador",
"delete_modal_description": "Esto eliminará todos los archivos de instalación de su computadora.", "delete_modal_description": "Esto eliminará todos los archivos de instalación de tu computadora.",
"delete_modal_title": "¿Está seguro?", "delete_modal_title": "¿Estás seguro?",
"deleting": "Eliminando instalador…", "deleting": "Eliminando instalador…",
"install": "Instalar" "install": "Instalar"
}, },
@ -136,6 +151,9 @@
"description": "Los ejecutables de Wine o Lutris no se encontraron en su sistema", "description": "Los ejecutables de Wine o Lutris no se encontraron en su sistema",
"instructions": "Comprueba como instalar de forma correcta uno de los dos en tu distro de Linux para ejecutar el juego con normalidad" "instructions": "Comprueba como instalar de forma correcta uno de los dos en tu distro de Linux para ejecutar el juego con normalidad"
}, },
"modal": {
"close": "Botón de cierre"
},
"catalogue": { "catalogue": {
"next_page": "Siguiente página", "next_page": "Siguiente página",
"previous_page": "Pagina anterior" "previous_page": "Pagina anterior"

View File

@ -11,7 +11,7 @@ const addGameToLibrary = async (
objectID: string, objectID: string,
title: string, title: string,
gameShop: GameShop, gameShop: GameShop,
executablePath: string executablePath: string | null
) => { ) => {
const game = await gameRepository.findOne({ const game = await gameRepository.findOne({
where: { where: {

View File

@ -5,7 +5,11 @@ import { registerEvent } from "../register-event";
const showOpenDialog = async ( const showOpenDialog = async (
_event: Electron.IpcMainInvokeEvent, _event: Electron.IpcMainInvokeEvent,
options: Electron.OpenDialogOptions options: Electron.OpenDialogOptions
) => dialog.showOpenDialog(WindowManager.mainWindow, options); ) => {
if (WindowManager.mainWindow) {
dialog.showOpenDialog(WindowManager.mainWindow, options);
}
};
registerEvent(showOpenDialog, { registerEvent(showOpenDialog, {
name: "showOpenDialog", name: "showOpenDialog",

View File

@ -85,7 +85,7 @@ app.on("second-instance", (_event, commandLine) => {
WindowManager.createMainWindow(); WindowManager.createMainWindow();
} }
const [, path] = commandLine.pop().split("://"); const [, path] = commandLine.pop()?.split("://") ?? [];
if (path) WindowManager.redirect(path); if (path) WindowManager.redirect(path);
}); });

View File

@ -41,7 +41,8 @@ export const getSteam250List = async () => {
).flat(); ).flat();
const gamesMap: Map<string, Steam250Game> = gamesList.reduce((map, item) => { const gamesMap: Map<string, Steam250Game> = gamesList.reduce((map, item) => {
map.set(item.objectID, item); if (item) map.set(item.objectID, item);
return map; return map;
}, new Map()); }, new Map());

View File

@ -1,4 +1,4 @@
import { BrowserWindow, Menu, Notification, Tray, app } from "electron"; import { BrowserWindow, Menu, Tray, app } from "electron";
import { is } from "@electron-toolkit/utils"; import { is } from "@electron-toolkit/utils";
import { t } from "i18next"; import { t } from "i18next";
import path from "node:path"; import path from "node:path";
@ -50,15 +50,15 @@ export class WindowManager {
this.loadURL(); this.loadURL();
this.mainWindow.removeMenu(); this.mainWindow.removeMenu();
const userPreferences = await userPreferencesRepository.findOne({
where: { id: 1 },
});
this.mainWindow.on("ready-to-show", () => { this.mainWindow.on("ready-to-show", () => {
if (!app.isPackaged) WindowManager.mainWindow?.webContents.openDevTools(); if (!app.isPackaged) WindowManager.mainWindow?.webContents.openDevTools();
}); });
this.mainWindow.on("close", () => { this.mainWindow.on("close", async () => {
const userPreferences = await userPreferencesRepository.findOne({
where: { id: 1 },
});
if (userPreferences?.preferQuitInsteadOfHiding) { if (userPreferences?.preferQuitInsteadOfHiding) {
app.quit(); app.quit();
} }

View File

@ -56,7 +56,7 @@ declare global {
objectID: string, objectID: string,
title: string, title: string,
shop: GameShop, shop: GameShop,
executablePath: string executablePath: string | null
) => Promise<void>; ) => Promise<void>;
getLibrary: () => Promise<Game[]>; getLibrary: () => Promise<Game[]>;
getRepackersFriendlyNames: () => Promise<Record<string, string>>; getRepackersFriendlyNames: () => Promise<Record<string, string>>;

View File

@ -24,5 +24,7 @@ export const getSteamLanguage = (language: string) => {
if (language.startsWith("ru")) return "russian"; if (language.startsWith("ru")) return "russian";
if (language.startsWith("it")) return "italian"; if (language.startsWith("it")) return "italian";
if (language.startsWith("hu")) return "hungarian"; if (language.startsWith("hu")) return "hungarian";
if (language.startsWith("pl")) return "polish";
return "english"; return "english";
}; };

View File

@ -103,6 +103,7 @@ export function Downloads() {
</> </>
); );
} }
if (game?.status === "cancelled") return <p>{t("cancelled")}</p>; if (game?.status === "cancelled") return <p>{t("cancelled")}</p>;
if (game?.status === "downloading_metadata") if (game?.status === "downloading_metadata")
return <p>{t("starting_download")}</p>; return <p>{t("starting_download")}</p>;
@ -115,6 +116,8 @@ export function Downloads() {
</> </>
); );
} }
return null;
}; };
const openDeleteModal = (gameId: number) => { const openDeleteModal = (gameId: number) => {
@ -210,6 +213,12 @@ export function Downloads() {
); );
}; };
const handleDeleteGame = () => {
if (gameToBeDeleted.current) {
deleteGame(gameToBeDeleted.current).then(updateLibrary);
}
};
return ( return (
<section className={styles.downloadsContainer}> <section className={styles.downloadsContainer}>
<BinaryNotFoundModal <BinaryNotFoundModal
@ -219,9 +228,7 @@ export function Downloads() {
<DeleteModal <DeleteModal
visible={showDeleteModal} visible={showDeleteModal}
onClose={() => setShowDeleteModal(false)} onClose={() => setShowDeleteModal(false)}
deleteGame={() => deleteGame={handleDeleteGame}
deleteGame(gameToBeDeleted.current).then(updateLibrary)
}
/> />
<TextField placeholder={t("filter")} onChange={handleFilter} /> <TextField placeholder={t("filter")} onChange={handleFilter} />

View File

@ -68,7 +68,7 @@ export function HeroPanelActions({
try { try {
if (game) { if (game) {
await removeGameFromLibrary(game.id); await removeGameFromLibrary(game.id);
} else { } else if (gameDetails) {
const gameExecutablePath = await selectGameExecutable(); const gameExecutablePath = await selectGameExecutable();
await window.electron.addGameToLibrary( await window.electron.addGameToLibrary(
@ -87,30 +87,37 @@ export function HeroPanelActions({
}; };
const openGameInstaller = () => { const openGameInstaller = () => {
window.electron.openGameInstaller(game.id).then((isBinaryInPath) => { if (game) {
if (!isBinaryInPath) openBinaryNotFoundModal(); window.electron.openGameInstaller(game.id).then((isBinaryInPath) => {
updateLibrary(); if (!isBinaryInPath) openBinaryNotFoundModal();
}); updateLibrary();
});
}
}; };
const openGame = async () => { const openGame = async () => {
if (game.executablePath) { if (game) {
window.electron.openGame(game.id, game.executablePath); if (game.executablePath) {
return; window.electron.openGame(game.id, game.executablePath);
} return;
}
if (game?.executablePath) { if (game?.executablePath) {
window.electron.openGame(game.id, game.executablePath); window.electron.openGame(game.id, game.executablePath);
return; return;
} }
const gameExecutablePath = await selectGameExecutable(); const gameExecutablePath = await selectGameExecutable();
window.electron.openGame(game.id, gameExecutablePath); if (gameExecutablePath)
window.electron.openGame(game.id, gameExecutablePath);
}
}; };
const closeGame = () => window.electron.closeGame(game.id); const closeGame = () => {
if (game) window.electron.closeGame(game.id);
};
const deleting = isGameDeleting(game?.id); const deleting = game ? isGameDeleting(game?.id) : false;
const toggleGameOnLibraryButton = ( const toggleGameOnLibraryButton = (
<Button <Button
@ -124,7 +131,7 @@ export function HeroPanelActions({
</Button> </Button>
); );
if (isGameDownloading) { if (game && isGameDownloading) {
return ( return (
<> <>
<Button <Button

View File

@ -98,7 +98,7 @@ export function HeroPanel({
return <p>{t("deleting")}</p>; return <p>{t("deleting")}</p>;
} }
if (isGameDownloading) { if (isGameDownloading && gameDownloading?.status) {
return ( return (
<> <>
<p className={styles.downloadDetailsRow}> <p className={styles.downloadDetailsRow}>
@ -106,14 +106,14 @@ export function HeroPanel({
{eta && <small>{t("eta", { eta })}</small>} {eta && <small>{t("eta", { eta })}</small>}
</p> </p>
{gameDownloading?.status !== "downloading" ? ( {gameDownloading.status !== "downloading" ? (
<> <>
<p>{t(gameDownloading?.status)}</p> <p>{t(gameDownloading.status)}</p>
{eta && <small>{t("eta", { eta })}</small>} {eta && <small>{t("eta", { eta })}</small>}
</> </>
) : ( ) : (
<p className={styles.downloadDetailsRow}> <p className={styles.downloadDetailsRow}>
{formatBytes(gameDownloading?.bytesDownloaded)} /{" "} {formatBytes(gameDownloading.bytesDownloaded)} /{" "}
{finalDownloadSize} {finalDownloadSize}
<small> <small>
{numPeers} peers / {numSeeds} seeds {numPeers} peers / {numSeeds} seeds
@ -148,7 +148,7 @@ export function HeroPanel({
<> <>
<p> <p>
{t("play_time", { {t("play_time", {
amount: formatPlayTime(game.playTimeInMilliseconds), amount: formatPlayTime(),
})} })}
</p> </p>

View File

@ -89,7 +89,9 @@ export function RepacksModal({
<p style={{ color: "#DADBE1" }}>{repack.title}</p> <p style={{ color: "#DADBE1" }}>{repack.title}</p>
<p style={{ fontSize: "12px" }}> <p style={{ fontSize: "12px" }}>
{repack.fileSize} - {repackersFriendlyNames[repack.repacker]} -{" "} {repack.fileSize} - {repackersFriendlyNames[repack.repacker]} -{" "}
{format(repack.uploadDate, "dd/MM/yyyy")} {repack.uploadDate
? format(repack.uploadDate, "dd/MM/yyyy")
: ""}
</p> </p>
</Button> </Button>
))} ))}