mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 00:33:49 +03:00
feat: adding i18n for cloud sync
This commit is contained in:
parent
32fa69627c
commit
9b5e13ad35
@ -130,7 +130,20 @@
|
||||
"download": "Download",
|
||||
"executable_path_in_use": "Executable already in use by \"{{game}}\"",
|
||||
"warning": "Warning:",
|
||||
"hydra_needs_to_remain_open": "for this download, Hydra needs to remain open util its conclusion. In case Hydra closes before the conclusion, you will lose your progress."
|
||||
"hydra_needs_to_remain_open": "for this download, Hydra needs to remain open util its conclusion. In case Hydra closes before the conclusion, you will lose your progress.",
|
||||
"cloud_save": "Cloud save",
|
||||
"cloud_save_description": "Save your progress in the cloud and continue playing on any device",
|
||||
"backups": "Backups",
|
||||
"install_backup": "Install",
|
||||
"delete_backup": "Delete",
|
||||
"create_backup": "Create backup",
|
||||
"last_backup_date": "Last backup on {{date}}",
|
||||
"no_backup_preview": "Hydra could not locate any save games for this game",
|
||||
"restoring_backup": "Restoring backup…",
|
||||
"uploading_backup": "Uploading backup…",
|
||||
"no_backups": "You haven't created any backups for this game yet",
|
||||
"backup_uploaded": "Backup uploaded",
|
||||
"backup_deleted": "Backup deleted"
|
||||
},
|
||||
"activation": {
|
||||
"title": "Activate Hydra",
|
||||
|
@ -126,7 +126,21 @@
|
||||
"download": "Baixar",
|
||||
"executable_path_in_use": "Executável em uso por \"{{game}}\"",
|
||||
"warning": "Aviso:",
|
||||
"hydra_needs_to_remain_open": "para este download, o Hydra precisa ficar aberto até a conclusão. Caso o Hydra encerre antes da conclusão, perderá seu progresso."
|
||||
"hydra_needs_to_remain_open": "para este download, o Hydra precisa ficar aberto até a conclusão. Caso o Hydra encerre antes da conclusão, perderá seu progresso.",
|
||||
|
||||
"cloud_save": "Salvamento em nuvem",
|
||||
"cloud_save_description": "Matenha seu progresso na nuvem e continue de onde parou em qualquer dispositivo",
|
||||
"backups": "Backups",
|
||||
"install_backup": "Restaurar",
|
||||
"delete_backup": "Apagar",
|
||||
"create_backup": "Criar backup",
|
||||
"last_backup_date": "Último backup em {{date}}",
|
||||
"no_backup_preview": "Hydra não encontrou nenhum save para este jogo",
|
||||
"restoring_backup": "Restaurando backup…",
|
||||
"uploading_backup": "Criando backup…",
|
||||
"no_backups": "Você ainda não fez nenhum backup deste jogo",
|
||||
"backup_uploaded": "Backup criado",
|
||||
"backup_deleted": "Backup apagado"
|
||||
},
|
||||
"activation": {
|
||||
"title": "Ativação",
|
||||
|
@ -58,12 +58,12 @@ import "./profile/update-profile";
|
||||
import "./profile/process-profile-image";
|
||||
import "./profile/send-friend-request";
|
||||
import "./profile/sync-friend-requests";
|
||||
import "./cloud-sync/download-game-artifact";
|
||||
import "./cloud-sync//get-game-artifacts";
|
||||
import "./cloud-sync/get-game-backup-preview";
|
||||
import "./cloud-sync/upload-save-game";
|
||||
import "./cloud-sync/check-game-cloud-sync-support";
|
||||
import "./cloud-sync/delete-game-artifact";
|
||||
import "./cloud-save/download-game-artifact";
|
||||
import "./cloud-save/get-game-artifacts";
|
||||
import "./cloud-save/get-game-backup-preview";
|
||||
import "./cloud-save/upload-save-game";
|
||||
import "./cloud-save/check-game-cloud-sync-support";
|
||||
import "./cloud-save/delete-game-artifact";
|
||||
import { isPortableVersion } from "@main/helpers";
|
||||
|
||||
ipcMain.handle("ping", () => "pong");
|
||||
|
@ -115,7 +115,7 @@ contextBridge.exposeInMainWorld("electron", {
|
||||
getDiskFreeSpace: (path: string) =>
|
||||
ipcRenderer.invoke("getDiskFreeSpace", path),
|
||||
|
||||
/* Cloud sync */
|
||||
/* Cloud save */
|
||||
uploadSaveGame: (objectId: string, shop: GameShop) =>
|
||||
ipcRenderer.invoke("uploadSaveGame", objectId, shop),
|
||||
downloadGameArtifact: (
|
||||
|
2
src/renderer/src/declaration.d.ts
vendored
2
src/renderer/src/declaration.d.ts
vendored
@ -115,7 +115,7 @@ declare global {
|
||||
/* Hardware */
|
||||
getDiskFreeSpace: (path: string) => Promise<DiskSpace>;
|
||||
|
||||
/* Cloud sync */
|
||||
/* Cloud save */
|
||||
uploadSaveGame: (objectId: string, shop: GameShop) => Promise<void>;
|
||||
downloadGameArtifact: (
|
||||
objectId: string,
|
||||
|
@ -16,6 +16,7 @@ import {
|
||||
} from "@primer/octicons-react";
|
||||
import { useToast } from "@renderer/hooks";
|
||||
import { GameBackup, gameBackupsTable } from "@renderer/dexie";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export interface CloudSyncModalProps
|
||||
extends Omit<ModalProps, "children" | "title"> {}
|
||||
@ -24,6 +25,8 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) {
|
||||
const [deletingArtifact, setDeletingArtifact] = useState(false);
|
||||
const [lastBackup, setLastBackup] = useState<GameBackup | null>(null);
|
||||
|
||||
const { t } = useTranslation("game_details");
|
||||
|
||||
const {
|
||||
artifacts,
|
||||
backupPreview,
|
||||
@ -44,7 +47,7 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) {
|
||||
try {
|
||||
await deleteGameArtifact(gameArtifactId);
|
||||
|
||||
showSuccessToast("backup_successfully_deleted");
|
||||
showSuccessToast(t("backup_deleted"));
|
||||
} catch (err) {
|
||||
showErrorToast("backup_deletion_failed");
|
||||
} finally {
|
||||
@ -64,7 +67,7 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) {
|
||||
return (
|
||||
<span style={{ display: "flex", alignItems: "center", gap: 8 }}>
|
||||
<SyncIcon />
|
||||
creating_backup
|
||||
{t("uploading_backup")}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@ -73,34 +76,36 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) {
|
||||
return (
|
||||
<span style={{ display: "flex", alignItems: "center", gap: 8 }}>
|
||||
<SyncIcon />
|
||||
restoring_backup
|
||||
{t("restoring_backup")}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
if (lastBackup) {
|
||||
return (
|
||||
<p style={{ display: "flex", alignItems: "center", gap: 8 }}>
|
||||
<span style={{ display: "flex", alignItems: "center", gap: 8 }}>
|
||||
<CheckCircleFillIcon />
|
||||
Último backup em {format(lastBackup.createdAt, "dd/MM/yyyy HH:mm")}
|
||||
</p>
|
||||
{t("last_backup_date", {
|
||||
date: format(lastBackup.createdAt, "dd/MM/yyyy HH:mm"),
|
||||
})}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
if (!backupPreview) {
|
||||
return "no_backup_preview";
|
||||
return t("no_backup_preview");
|
||||
}
|
||||
|
||||
return "no_artifacts";
|
||||
}, [uploadingBackup, lastBackup, backupPreview, restoringBackup]);
|
||||
return t("no_backups");
|
||||
}, [uploadingBackup, lastBackup, backupPreview, restoringBackup, t]);
|
||||
|
||||
const disableActions = uploadingBackup || restoringBackup || deletingArtifact;
|
||||
|
||||
return (
|
||||
<Modal
|
||||
visible={visible}
|
||||
title="cloud_sync"
|
||||
description="cloud_sync_description"
|
||||
title={t("cloud_save")}
|
||||
description={t("cloud_save_description")}
|
||||
onClose={onClose}
|
||||
large
|
||||
>
|
||||
@ -114,7 +119,7 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) {
|
||||
>
|
||||
<div style={{ display: "flex", gap: 4, flexDirection: "column" }}>
|
||||
<h2>{gameTitle}</h2>
|
||||
{backupStateLabel}
|
||||
<p>{backupStateLabel}</p>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
@ -123,11 +128,11 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) {
|
||||
disabled={disableActions || !backupPreview}
|
||||
>
|
||||
<UploadIcon />
|
||||
create_backup
|
||||
{t("create_backup")}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<h2 style={{ marginBottom: 16 }}>backups</h2>
|
||||
<h2 style={{ marginBottom: 16 }}>{t("backups")}</h2>
|
||||
|
||||
<ul className={styles.artifacts}>
|
||||
{artifacts.map((artifact) => (
|
||||
@ -162,7 +167,7 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) {
|
||||
disabled={disableActions}
|
||||
>
|
||||
<DownloadIcon />
|
||||
install_artifact
|
||||
{t("install_backup")}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
@ -171,7 +176,7 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) {
|
||||
disabled={disableActions}
|
||||
>
|
||||
<TrashIcon />
|
||||
delete_artifact
|
||||
{t("delete_backup")}
|
||||
</Button>
|
||||
</div>
|
||||
</li>
|
||||
|
@ -132,7 +132,7 @@ export function GameDetailsContent() {
|
||||
style={{ width: 26, position: "absolute", top: -3 }}
|
||||
/>
|
||||
</div>
|
||||
cloud_sync
|
||||
{t("cloud_save")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user