Skip to content

Commit 4bad08d

Browse files
committed
add back translations + add new overlay
1 parent ce85254 commit 4bad08d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

next.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const nextConfig = {
1111
experimental: {
1212
scrollRestoration: true,
1313
reactCompiler: true,
14+
newDevOverlay: true,
1415
},
1516

1617
env: {},

src/app/[[...markdownPath]]/page.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import sidebarBlog from '../../sidebarBlog.json';
99
import {generateMDX} from '../../utils/generateMDX';
1010

1111
import {RouteItem} from 'components/Layout/getRouteMeta';
12+
import {LanguageItem} from 'components/MDX/LanguagesContext';
1213

1314
function 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
);

0 commit comments

Comments
 (0)