@@ -20,6 +20,7 @@ import { github } from "~/lib/github"
2020import { createEffect , onCleanup } from "solid-js"
2121import { config } from "~/config"
2222import { useI18n } from "~/context/i18n"
23+ import { useLanguage } from "~/context/language"
2324import "./header-context-menu.css"
2425
2526const isDarkMode = ( ) => window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches
@@ -38,6 +39,7 @@ const fetchSvgContent = async (svgPath: string): Promise<string> => {
3839export function Header ( props : { zen ?: boolean ; hideGetStarted ?: boolean } ) {
3940 const navigate = useNavigate ( )
4041 const i18n = useI18n ( )
42+ const language = useLanguage ( )
4143 const githubData = createAsync ( ( ) => github ( ) )
4244 const starCount = createMemo ( ( ) =>
4345 githubData ( ) ?. stars
@@ -121,7 +123,7 @@ export function Header(props: { zen?: boolean; hideGetStarted?: boolean }) {
121123 return (
122124 < section data-component = "top" >
123125 < div onContextMenu = { handleLogoContextMenu } >
124- < A href = "/" >
126+ < A href = { language . route ( "/" ) } >
125127 < img data-slot = "logo light" src = { logoLight } alt = "OpenCode" width = "189" height = "34" />
126128 < img data-slot = "logo dark" src = { logoDark } alt = "OpenCode" width = "189" height = "34" />
127129 </ A >
@@ -142,7 +144,7 @@ export function Header(props: { zen?: boolean; hideGetStarted?: boolean }) {
142144 < img data-slot = "copy dark" src = { copyWordmarkDark } alt = "" />
143145 { i18n . t ( "nav.context.copyWordmark" ) }
144146 </ button >
145- < button class = "context-menu-item" onClick = { ( ) => navigate ( "/brand" ) } >
147+ < button class = "context-menu-item" onClick = { ( ) => navigate ( language . route ( "/brand" ) ) } >
146148 < img data-slot = "copy light" src = { copyBrandAssetsLight } alt = "" />
147149 < img data-slot = "copy dark" src = { copyBrandAssetsDark } alt = "" />
148150 { i18n . t ( "nav.context.brandAssets" ) }
@@ -157,24 +159,24 @@ export function Header(props: { zen?: boolean; hideGetStarted?: boolean }) {
157159 </ a >
158160 </ li >
159161 < li >
160- < a href = "/docs" > { i18n . t ( "nav.docs" ) } </ a >
162+ < a href = { language . route ( "/docs" ) } > { i18n . t ( "nav.docs" ) } </ a >
161163 </ li >
162164 < li >
163- < A href = "/enterprise" > { i18n . t ( "nav.enterprise" ) } </ A >
165+ < A href = { language . route ( "/enterprise" ) } > { i18n . t ( "nav.enterprise" ) } </ A >
164166 </ li >
165167 < li >
166168 < Switch >
167169 < Match when = { props . zen } >
168- < a href = "/auth" > { i18n . t ( "nav.login" ) } </ a >
170+ < a href = { language . route ( "/auth" ) } > { i18n . t ( "nav.login" ) } </ a >
169171 </ Match >
170172 < Match when = { ! props . zen } >
171- < A href = "/zen" > { i18n . t ( "nav.zen" ) } </ A >
173+ < A href = { language . route ( "/zen" ) } > { i18n . t ( "nav.zen" ) } </ A >
172174 </ Match >
173175 </ Switch >
174176 </ li >
175177 < Show when = { ! props . hideGetStarted } >
176178 < li >
177- < A href = "/download" data-slot = "cta-button" >
179+ < A href = { language . route ( "/download" ) } data-slot = "cta-button" >
178180 < svg
179181 width = "18"
180182 height = "18"
@@ -245,32 +247,32 @@ export function Header(props: { zen?: boolean; hideGetStarted?: boolean }) {
245247 < nav data-component = "nav-mobile-menu-list" >
246248 < ul >
247249 < li >
248- < A href = "/" > { i18n . t ( "nav.home" ) } </ A >
250+ < A href = { language . route ( "/" ) } > { i18n . t ( "nav.home" ) } </ A >
249251 </ li >
250252 < li >
251253 < a href = { config . github . repoUrl } target = "_blank" style = "white-space: nowrap;" >
252254 { i18n . t ( "nav.github" ) } < span > [{ starCount ( ) } ]</ span >
253255 </ a >
254256 </ li >
255257 < li >
256- < a href = "/docs" > { i18n . t ( "nav.docs" ) } </ a >
258+ < a href = { language . route ( "/docs" ) } > { i18n . t ( "nav.docs" ) } </ a >
257259 </ li >
258260 < li >
259- < A href = "/enterprise" > { i18n . t ( "nav.enterprise" ) } </ A >
261+ < A href = { language . route ( "/enterprise" ) } > { i18n . t ( "nav.enterprise" ) } </ A >
260262 </ li >
261263 < li >
262264 < Switch >
263265 < Match when = { props . zen } >
264- < a href = "/auth" > { i18n . t ( "nav.login" ) } </ a >
266+ < a href = { language . route ( "/auth" ) } > { i18n . t ( "nav.login" ) } </ a >
265267 </ Match >
266268 < Match when = { ! props . zen } >
267- < A href = "/zen" > { i18n . t ( "nav.zen" ) } </ A >
269+ < A href = { language . route ( "/zen" ) } > { i18n . t ( "nav.zen" ) } </ A >
268270 </ Match >
269271 </ Switch >
270272 </ li >
271273 < Show when = { ! props . hideGetStarted } >
272274 < li >
273- < A href = "/download" data-slot = "cta-button" >
275+ < A href = { language . route ( "/download" ) } data-slot = "cta-button" >
274276 { i18n . t ( "nav.getStartedFree" ) }
275277 </ A >
276278 </ li >
0 commit comments