From 5667c813d9c085acc075d339a37677ba697358bc Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Mon, 20 May 2024 16:05:33 -0300 Subject: [PATCH] feat: add strings to translations file --- src/locales/en/translation.json | 6 ++++++ src/locales/pt/translation.json | 6 ++++++ src/renderer/src/pages/splash/splash.tsx | 12 +++++++----- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 7b54b889..1c948ba8 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -176,5 +176,11 @@ }, "modal": { "close": "Close button" + }, + "splash": { + "downloading_version": "Downloading version {{version}}", + "searching_updates": "Searching for updates", + "update_found": "Update {{version}} found", + "restarting_and_applying": "Restarting and applying update" } } diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json index 57ec0470..6894fb7c 100644 --- a/src/locales/pt/translation.json +++ b/src/locales/pt/translation.json @@ -176,5 +176,11 @@ }, "modal": { "close": "Botão de fechar" + }, + "splash": { + "downloading_version": "Baixando versão {{version}}", + "searching_updates": "Buscando atualizações", + "update_found": "Versão {{version}} encontrada", + "restarting_and_applying": "Reiniciando e aplicando atualização" } } diff --git a/src/renderer/src/pages/splash/splash.tsx b/src/renderer/src/pages/splash/splash.tsx index 40407a57..96f69b7b 100644 --- a/src/renderer/src/pages/splash/splash.tsx +++ b/src/renderer/src/pages/splash/splash.tsx @@ -5,6 +5,7 @@ import { themeClass } from "../../theme.css"; import "../../app.css"; import { useEffect, useState } from "react"; import { AppUpdaterEvents } from "@types"; +import { useTranslation } from "react-i18next"; document.body.classList.add(themeClass); @@ -12,8 +13,9 @@ export default function Splash() { const [status, setStatus] = useState(null); const [newVersion, setNewVersion] = useState(""); + const { t } = useTranslation("splash"); + useEffect(() => { - console.log("subscribing"); const unsubscribe = window.electron.onAutoUpdaterEvent( (event: AppUpdaterEvents) => { setStatus(event); @@ -50,7 +52,7 @@ export default function Splash() { case "download-progress": return ( <> -

Baixando versão {newVersion}

+

{t("downloading_version", { version: newVersion })}

); case "checking-for-updates": - return

Buscando atualizações

; + return

{t("searching_updates")}

; case "update-available": - return

Versão {status.info.version} encontrada

; + return

{t("update_found", { version: newVersion })}

; case "update-downloaded": - return

Reiniciando e aplicando atualização

; + return

{t("restarting_and_applying")}

; default: return <>; }