diff --git a/src/components/Auxilliary.tsx b/src/components/Auxilliary.tsx index ef89515..a25b397 100644 --- a/src/components/Auxilliary.tsx +++ b/src/components/Auxilliary.tsx @@ -6,6 +6,8 @@ import { isMobile } from "react-device-detect"; import { globeImg } from "../util/globe"; import { FormattedMessage } from "react-intl"; import { Link, useNavigate } from "react-router-dom"; +import localeList from "../i18n/messages"; +import { LocaleContext } from "../i18n/LocaleContext"; // import SnackAdUnit from "./SnackAdUnit"; const ReactGlobe = lazy(() => import("react-globe.gl")); @@ -14,6 +16,10 @@ type Props = { }; export default function Auxilliary({ screen }: Props) { + // Locales + const localeContext = useContext(LocaleContext); + const { locale } = localeContext; + // Navigation const navigate = useNavigate(); @@ -99,9 +105,9 @@ export default function Auxilliary({ screen }: Props) { {(screen === "Help" || screen === "Settings") && (

- Globle: Capitals is now available.{" "} + {localeList[locale]["Aux4"]} {localeList[locale]["Aux5"]}{" "} - Click here to play! + {localeList[locale]["Aux6"]} {" "}

)} diff --git a/src/components/Statistics.tsx b/src/components/Statistics.tsx index 08bde07..28ff9ad 100644 --- a/src/components/Statistics.tsx +++ b/src/components/Statistics.tsx @@ -116,22 +116,22 @@ ${lastWin === today ? emojiGuesses : "--"} = ${todaysGuesses} try { if ("canShare" in navigator && isMobile && !isFirefox) { await navigator.share({ title: "Plurality Stats", text: shareString }); - setMsg("Shared!"); + setMsg(localeList[locale]["Shared"]); setShowCopyMsg(true); return setTimeout(() => setShowCopyMsg(false), 2000); } else if (navigator.clipboard && window.isSecureContext) { await navigator.clipboard.writeText(shareString); - setMsg("Copied!"); + setMsg(localeList[locale]["Shared"]); setShowCopyMsg(true); return setTimeout(() => setShowCopyMsg(false), 2000); } else { document.execCommand("copy", true, shareString); - setMsg("Copied!"); + setMsg(localeList[locale]["Shared"]); setShowCopyMsg(true); return setTimeout(() => setShowCopyMsg(false), 2000); } } catch (e) { - setMsg("This browser cannot share"); + setMsg(localeList[locale]["ShareErr"]); setShowCopyMsg(true); return setTimeout(() => setShowCopyMsg(false), 2000); } @@ -209,7 +209,7 @@ ${lastWin === today ? emojiGuesses : "--"} = ${todaysGuesses} className="text-md text-center font-extrabold dark:text-gray-200 mb-2" style={{ fontFamily: "'Montserrat'" }} > - New game from the creator of Globle! + diff --git a/src/i18n/messages/de-DE.ts b/src/i18n/messages/de-DE.ts index 3560f38..593dcd5 100644 --- a/src/i18n/messages/de-DE.ts +++ b/src/i18n/messages/de-DE.ts @@ -17,6 +17,9 @@ export const German: Messages = { Aux1: `["Klick auf", "Drücke"] den Globus zum Spielen!`, Aux2: "Hast du eine Frage?", Aux3: "Schau dir das FAQ an", + Aux4: "Globle: Capitals", // TODO: Translate this + Aux5: "is now Available.", // TODO: Translate this + Aux6: "Click here to play!", // TODO: Translate this Footer1: "von The Abe Train", Footer2: "Gefällt dir das Spiel?", Footer3: "Kauf mir einen Kaffee", @@ -78,4 +81,10 @@ export const German: Messages = { PracticeNew: "New practice game", //TODO: Translate SortByGuesses: "Sort by order of guesses", //TODO: Translate SortByDistance: "Sort by distance", //TODO: Translate + Copied: "Copied!", // TODO: Translate this + Shared: "Shared!", // TODO: Translate this + ShareErr: "This browser cannot share", // TODO: Translate this + ShamelessPlug: "New game from the creator of Globle!", // TODO: Translate this + Yes: "Yes", // TODO: Translate this + No: "No", // TODO: Translate this }; diff --git a/src/i18n/messages/en-CA.ts b/src/i18n/messages/en-CA.ts index b89db8a..23667fb 100644 --- a/src/i18n/messages/en-CA.ts +++ b/src/i18n/messages/en-CA.ts @@ -16,6 +16,9 @@ export const English: Messages = { Aux1: `["Click", "Tap"] the globe to play!`, Aux2: "Have a question?", Aux3: "Check out the FAQ", + Aux4: "Globle: Capitals", + Aux5: "is now Available.", + Aux6: "Click here to play!", Footer1: "by The Abe Train", Footer2: "Enjoying the game?", Footer3: "Buy me a coffee", @@ -79,4 +82,10 @@ export const English: Messages = { PracticeNew: "New practice game", SortByGuesses: "Sort by order of guesses", SortByDistance: "Sort by distance", + Copied: "Copied!", + Shared: "Shared!", + ShareErr: "This browser cannot share", + ShamelessPlug: "New game from the creator of Globle!", + Yes: "Yes", + No: "No", }; diff --git a/src/i18n/messages/es-MX.ts b/src/i18n/messages/es-MX.ts index 5a4b066..fcb7fdc 100644 --- a/src/i18n/messages/es-MX.ts +++ b/src/i18n/messages/es-MX.ts @@ -13,6 +13,9 @@ export const Spanish: Messages = { Aux1: "¡Haz click en el globo para jugar!", Aux2: "¿Tienes alguna duda?", Aux3: "Visita Preguntas Frecuentes.", + Aux4: "Globle: Capitals", // TODO: Translate this + Aux5: "is now Available.", // TODO: Translate this + Aux6: "Click here to play!", // TODO: Translate this Footer1: "Creado por The Abe Train", Footer2: "¿Estas disfrutando el juego?", Footer3: "Cómprame un café!", @@ -75,6 +78,12 @@ export const Spanish: Messages = { PracticeNew: "New practice game", //TODO: Translate SortByGuesses: "Sort by order of guesses", //TODO: Translate SortByDistance: "Sort by distance", //TODO: Translate + Copied: "Copied!", // TODO: Translate this + Shared: "Shared!", // TODO: Translate this + ShareErr: "This browser cannot share", // TODO: Translate this + ShamelessPlug: "New game from the creator of Globle!", // TODO: Translate this + Yes: "Yes", // TODO: Translate this + No: "No", // TODO: Translate this }; // export default { diff --git a/src/i18n/messages/fr-FR.ts b/src/i18n/messages/fr-FR.ts index c66ff6d..5dd7652 100644 --- a/src/i18n/messages/fr-FR.ts +++ b/src/i18n/messages/fr-FR.ts @@ -17,6 +17,9 @@ export const French: Messages = { Aux1: `["Cliquez sur", "Touchez"] le globe pour jouer!`, Aux2: "Vous avez une question?", Aux3: "Consultez la FAQ", + Aux4: "Globle: Capitals", // TODO: Translate this + Aux5: "is now Available.", // TODO: Translate this + Aux6: "Click here to play!", // TODO: Translate this Footer1: "Auteur: The Abe Train", Footer2: "Le jeu vous plaît?", Footer3: "Payez-moi un café.", @@ -79,4 +82,10 @@ export const French: Messages = { PracticeNew: "Nouvelle partie d'entraînement", SortByGuesses: "Trier par ordre des tentatives", SortByDistance: "Trier par distance", + Copied: "Copied!", // TODO: Translate this + Shared: "Shared!", // TODO: Translate this + ShareErr: "This browser cannot share", // TODO: Translate this + ShamelessPlug: "New game from the creator of Globle!", // TODO: Translate this + Yes: "Yes", // TODO: Translate this + No: "No", // TODO: Translate this }; diff --git a/src/i18n/messages/hu-HU.ts b/src/i18n/messages/hu-HU.ts index e3bf29b..30868ad 100644 --- a/src/i18n/messages/hu-HU.ts +++ b/src/i18n/messages/hu-HU.ts @@ -17,6 +17,9 @@ export const Hungarian: Messages = { Aux1: `["Kattincs", "Tap"] a földgömbre!`, Aux2: "Van kérdésed?", Aux3: "Nézd meg a gyakori kérdéseket", + Aux4: "Globle: Capitals", // TODO: Translate this + Aux5: "is now Available.", // TODO: Translate this + Aux6: "Click here to play!", // TODO: Translate this Footer1: "The Abe Train által", Footer2: "Élvezed a játékot?", Footer3: "Hívj meg egy kávera", @@ -78,4 +81,10 @@ export const Hungarian: Messages = { Guessed: "sejtette", SortByGuesses: "Rendezés a találgatások sorrendje szerint", SortByDistance: "Rendezés távolság szerint", + Copied: "Copied!", // TODO: Translate this + Shared: "Shared!", // TODO: Translate this + ShareErr: "This browser cannot share", // TODO: Translate this + ShamelessPlug: "New game from the creator of Globle!", // TODO: Translate this + Yes: "Yes", // TODO: Translate this + No: "No", // TODO: Translate this }; diff --git a/src/i18n/messages/it_IT.ts b/src/i18n/messages/it_IT.ts index 09acf28..6bd2d54 100644 --- a/src/i18n/messages/it_IT.ts +++ b/src/i18n/messages/it_IT.ts @@ -17,6 +17,9 @@ export const Italian: Messages = { Aux1: `["Clicca", "Tap"] sul globo per giocare!`, Aux2: "Hai una domanda?", Aux3: "Vai a vedere le FAQ", + Aux4: "Globle: Capitals", // TODO: Translate this + Aux5: "is now Available.", // TODO: Translate this + Aux6: "Click here to play!", // TODO: Translate this Footer1: "di The Abe Train", Footer2: "Ti piace il gioco?", Footer3: "Offrimi un caffè", @@ -79,4 +82,10 @@ export const Italian: Messages = { PracticeNew: "Nuovo gioco di pratica", SortByGuesses: "Sort by order of guesses", //TODO: Translate SortByDistance: "Sort by distance", //TODO: Translate + Copied: "Copied!", // TODO: Translate this + Shared: "Shared!", // TODO: Translate this + ShareErr: "This browser cannot share", // TODO: Translate this + ShamelessPlug: "New game from the creator of Globle!", // TODO: Translate this + Yes: "Yes", // TODO: Translate this + No: "No", // TODO: Translate this }; diff --git a/src/i18n/messages/pl-PL.ts b/src/i18n/messages/pl-PL.ts index e306a49..942b2f8 100644 --- a/src/i18n/messages/pl-PL.ts +++ b/src/i18n/messages/pl-PL.ts @@ -13,6 +13,9 @@ export const Polish: Messages = { Aux1: `["Kliknij", "Dotknij"] kulę ziemską, żeby zagrać!`, Aux2: "Masz pytania?", Aux3: "Zobacz FAQ", + Aux4: "Globle: Capitals", // TODO: Translate this + Aux5: "is now Available.", // TODO: Translate this + Aux6: "Click here to play!", // TODO: Translate this Footer1: "stworzone przez The Abe Train", Footer2: "Podoba Ci się gra?", Footer3: "Kup mi kawę", @@ -74,4 +77,10 @@ export const Polish: Messages = { PracticeNew: "Nowa gra treningowa", SortByGuesses: "Sort by order of guesses", //TODO: Translate SortByDistance: "Sort by distance", //TODO: Translate + Copied: "Copied!", // TODO: Translate this + Shared: "Shared!", // TODO: Translate this + ShareErr: "This browser cannot share", // TODO: Translate this + ShamelessPlug: "New game from the creator of Globle!", // TODO: Translate this + Yes: "Yes", // TODO: Translate this + No: "No", // TODO: Translate this }; diff --git a/src/i18n/messages/pt-BR.ts b/src/i18n/messages/pt-BR.ts index a7adeb0..3c2d376 100644 --- a/src/i18n/messages/pt-BR.ts +++ b/src/i18n/messages/pt-BR.ts @@ -17,6 +17,9 @@ export const Portuguese: Messages = { Aux1: `["Clique", "Toque"] no globo para jogar`, Aux2: "Alguma dúvida?", Aux3: "Cheque a área Perguntas Frequentes", + Aux4: "Globle: Capitals", + Aux5: "está disponível.", + Aux6: "Clique aqui para jogar!", Footer1: "por The Abe Train", Footer2: "Curtindo o jogo?", Footer3: "Pague meu cafezinho", @@ -71,11 +74,17 @@ export const Portuguese: Messages = { Settings10: "Arco-íris ativado", Settings11: "Arco-íris desativado", Answer: "Resposta", - Closest: "Mais próximo", + Closest: "Mais próximos", Guessed: "Chutados", PracticeMode: "Você está no modo de treino.", PracticeExit: "Sair do modo de treino", - PracticeNew: "Novo jogo de trino", + PracticeNew: "Novo jogo de treino", SortByGuesses: "Listar pela ordem dos chutes", SortByDistance: "Ordenar pela distância", + Copied: "Copiado!", + Shared: "Compartilhado!", + ShareErr: "This browser cannot share", + ShamelessPlug: "Novo jogo do criador de Globle!", + Yes: "Sim", + No: "Não", }; diff --git a/src/i18n/messages/sv-SE.ts b/src/i18n/messages/sv-SE.ts index f6651fd..00ace1f 100644 --- a/src/i18n/messages/sv-SE.ts +++ b/src/i18n/messages/sv-SE.ts @@ -13,6 +13,9 @@ export const Swedish: Messages = { Aux1: `["Klicka", "Tryck"] på globen för att spela!`, Aux2: "Har du en fråga?", Aux3: "Läs vår FAQ", + Aux4: "Globle: Capitals", // TODO: Translate this + Aux5: "is now Available.", // TODO: Translate this + Aux6: "Click here to play!", // TODO: Translate this Footer1: "av The Abe Train", Footer2: "Gillar du spelet?", Footer3: "Bjud mig på en kaffe", @@ -74,4 +77,10 @@ export const Swedish: Messages = { Guessed: "gissade", SortByGuesses: "Sortera efter gissningsordning", SortByDistance: "Sortera efter avstånd", + Copied: "Copied!", // TODO: Translate this + Shared: "Shared!", // TODO: Translate this + ShareErr: "This browser cannot share", // TODO: Translate this + ShamelessPlug: "New game from the creator of Globle!", // TODO: Translate this + Yes: "Yes", // TODO: Translate this + No: "No", // TODO: Translate this }; diff --git a/src/lib/locale.d.ts b/src/lib/locale.d.ts index d7d1d0e..a5ae6e8 100644 --- a/src/lib/locale.d.ts +++ b/src/lib/locale.d.ts @@ -22,6 +22,9 @@ export type Messages = { Aux1: string; Aux2: string; Aux3: string; + Aux4: string; + Aux5: string; + Aux6: string; Footer1: string; Footer2: string; Footer3: string; @@ -85,6 +88,12 @@ export type Messages = { PracticeNew: string; SortByGuesses: string; SortByDistance: string; + Copied: string; + Shared: string; + ShareErr: string; + ShamelessPlug: string; + Yes: string; + No: string; }; export type LocaleMessages = Record;