@@ -6,20 +6,24 @@ import classes from "./header.module.css";
66import Image from "next/image" ;
77import Link from "next/link" ;
88import { usePathname } from "next/navigation" ;
9- import { LanguageSwitcher } from "next-export-i18n" ;
10- import React , { Suspense , useState , useEffect } from "react" ;
9+ import { LanguageSwitcher , useTranslation } from "next-export-i18n" ;
10+ import React , { useState , useEffect } from "react" ;
1111
1212const links = [
13- { link : "/" , label : "About Ruffle" } ,
14- { link : "/downloads" , label : "Downloads" } ,
15- { link : "/compatibility" , label : "Compatibility" } ,
16- { link : "/contribute" , label : "Get Involved" } ,
17- { link : "/blog" , label : "Blog" } ,
18- { link : "/demo" , label : "Demo" , target : "_blank" } ,
19- { link : "https://discord.gg/ruffle" , label : "Discord" , target : "_blank" } ,
13+ { link : "/" , labelKey : "header.about" } ,
14+ { link : "/downloads" , labelKey : "header.downloads" } ,
15+ { link : "/compatibility" , labelKey : "header.compatibility" } ,
16+ { link : "/contribute" , labelKey : "header.contribute" } ,
17+ { link : "/blog" , labelKey : "header.blog" } ,
18+ { link : "/demo" , labelKey : "header.demo" , target : "_blank" } ,
19+ {
20+ link : "https://discord.gg/ruffle" ,
21+ labelKey : "header.discord" ,
22+ target : "_blank" ,
23+ } ,
2024 {
2125 link : "https://github.com/ruffle-rs/ruffle/" ,
22- label : "GitHub " ,
26+ labelKey : "header.github " ,
2327 target : "_blank" ,
2428 } ,
2529] ;
@@ -64,19 +68,21 @@ export function Header() {
6468
6569 const [ opened , { toggle, close } ] = useDisclosure ( false ) ;
6670 const pathname = usePathname ( ) ;
71+ const { t } = useTranslation ( ) ;
6772
6873 const items = links . map ( ( link ) => (
6974 < Link
70- key = { link . label }
75+ key = { link . labelKey }
7176 href = { link . link }
7277 target = { link . target }
7378 className = { classes . link }
7479 data-active = { pathname === link . link || undefined }
7580 onClick = { ( ) => {
7681 close ( ) ;
7782 } }
83+ suppressHydrationWarning
7884 >
79- { link . label }
85+ { t ( link . labelKey ) }
8086 </ Link >
8187 ) ) ;
8288
@@ -103,11 +109,9 @@ export function Header() {
103109 </ select >
104110 </ Group > { " " }
105111 { Object . keys ( languages ) . map ( ( langCode ) => (
106- < Suspense key = { langCode } >
107- < LanguageSwitcher lang = { langCode } >
108- { languages [ langCode ] }
109- </ LanguageSwitcher >
110- </ Suspense >
112+ < LanguageSwitcher key = { langCode } lang = { langCode } >
113+ { languages [ langCode ] }
114+ </ LanguageSwitcher >
111115 ) ) }
112116 < Drawer
113117 opened = { opened }
0 commit comments