fix initial translation loading on starting page

This commit is contained in:
Jon Eugster
2024-03-29 12:16:36 +01:00
parent 10391b616c
commit 684a1bc72b
+6 -3
View File
@@ -39,13 +39,16 @@ function Tile({gameId, data}: {gameId: string, data: GameTile|undefined}) {
navigate(gameId); navigate(gameId);
} }
// we use this to reload the tile 1x after the translation is loaded.
let [loadedTranslation, setLoadedTranslation] = React.useState(false)
// Load the namespace of the game
i18next.loadNamespaces(gameId).catch(err => {}).then(() => {setLoadedTranslation(true)})
if (typeof data === 'undefined') { if (typeof data === 'undefined') {
return <></> return <></>
} }
// Load the namespace of the game
i18next.loadNamespaces(gameId)
return <div className="game" onClick={routeChange}> return <div className="game" onClick={routeChange}>
<div className="wrapper"> <div className="wrapper">
<div className="title">{t(data.title, { ns: gameId })}</div> <div className="title">{t(data.title, { ns: gameId })}</div>