File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
src/app/[[...markdownPath]] Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ const nextConfig = {
1111 experimental : {
1212 scrollRestoration : true ,
1313 reactCompiler : true ,
14+ newDevOverlay : true ,
1415 } ,
1516
1617 env : { } ,
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import sidebarBlog from '../../sidebarBlog.json';
99import { generateMDX } from '../../utils/generateMDX' ;
1010
1111import { RouteItem } from 'components/Layout/getRouteMeta' ;
12+ import { LanguageItem } from 'components/MDX/LanguagesContext' ;
1213
1314function getActiveSection ( pathname : string ) {
1415 if ( pathname === '/' ) {
@@ -110,14 +111,24 @@ export default async function WrapperPage({
110111 const section = getActiveSection ( pathname ) ;
111112 const routeTree = await getRouteTree ( section ) ;
112113
114+ // Load the list of translated languages conditionally.
115+ let languages : Array < LanguageItem > | null = null ;
116+ if ( pathname . endsWith ( '/translations' ) ) {
117+ languages = await (
118+ await fetch (
119+ 'https://raw.githubusercontent.com/reactjs/translations.react.dev/main/langs/langs.json'
120+ )
121+ ) . json ( ) ; // { code: string; name: string; enName: string}[]
122+ }
123+
113124 // Pass the content and TOC directly, as `getPageContent` should already return them in the correct format
114125 return (
115126 < Page
116127 toc = { toc } // Pass the TOC directly without parsing
117128 routeTree = { routeTree as RouteItem }
118129 meta = { meta }
119130 section = { section }
120- languages = { null } >
131+ languages = { languages } >
121132 { content }
122133 </ Page >
123134 ) ;
You can’t perform that action at this time.
0 commit comments