fix initial translation loading on starting page
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user