Skip to content

Commit 9514d12

Browse files
brijeshb42claude
andauthored
[docs-infra] Remove i18n codebase (#22591)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7a1c594 commit 9514d12

343 files changed

Lines changed: 1299 additions & 2581 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/next.config.ts

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ import * as semver from 'semver';
55
import { createRequire } from 'module';
66
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
77
import { withDeploymentConfig } from '@mui/internal-docs-infra/withDocsInfra';
8-
import {
9-
LANGUAGES,
10-
LANGUAGES_SSR,
11-
LANGUAGES_IGNORE_PAGES,
12-
LANGUAGES_IN_PROGRESS,
13-
} from '@mui/internal-core-docs/constants';
148
import { findPages } from './src/modules/utils/find';
159
import { SOURCE_CODE_REPO, SOURCE_GITHUB_BRANCH } from './constants';
1610
import { getPickerAdapterDeps } from './src/modules/utils/getPickerAdapterDeps';
@@ -134,8 +128,8 @@ export default withDeploymentConfig({
134128
loader: '@mui/internal-markdown/loader',
135129
options: {
136130
workspaceRoot: WORKSPACE_ROOT,
137-
ignoreLanguagePages: LANGUAGES_IGNORE_PAGES,
138-
languagesInProgress: LANGUAGES_IN_PROGRESS,
131+
ignoreLanguagePages: () => false,
132+
languagesInProgress: [],
139133
env: {
140134
SOURCE_CODE_REPO: options.config.env.SOURCE_CODE_REPO,
141135
LIB_VERSION: options.config.env.LIB_VERSION,
@@ -179,9 +173,7 @@ export default withDeploymentConfig({
179173
const map = {};
180174

181175
// @ts-ignore
182-
function traverse(pages2, userLanguage) {
183-
const prefix = userLanguage === 'en' ? '' : `/${userLanguage}`;
184-
176+
function traverse(pages2) {
185177
// @ts-ignore
186178
pages2.forEach((page) => {
187179
// The experiments pages are only meant for experiments, they shouldn't leak to production.
@@ -191,29 +183,17 @@ export default withDeploymentConfig({
191183

192184
if (!page.children) {
193185
// @ts-ignore
194-
map[`${prefix}${page.pathname.replace(/^\/api-docs\/(.*)/, '/api/$1')}`] = {
186+
map[page.pathname.replace(/^\/api-docs\/(.*)/, '/api/$1')] = {
195187
page: page.pathname,
196-
query: {
197-
userLanguage,
198-
},
199188
};
200189
return;
201190
}
202191

203-
traverse(page.children, userLanguage);
192+
traverse(page.children);
204193
});
205194
}
206195

207-
// We want to speed-up the build of pull requests.
208-
if (process.env.PULL_REQUEST === 'true') {
209-
// eslint-disable-next-line no-console
210-
console.log('Considering only English for SSR');
211-
traverse(pages, 'en');
212-
} else {
213-
LANGUAGES_SSR.forEach((userLanguage) => {
214-
traverse(pages, userLanguage);
215-
});
216-
}
196+
traverse(pages);
217197

218198
return map;
219199
},
@@ -224,10 +204,7 @@ export default withDeploymentConfig({
224204
}
225205
: {
226206
rewrites: async () => {
227-
return [
228-
{ source: `/:lang(${LANGUAGES.join('|')})?/:rest*`, destination: '/:rest*' },
229-
{ source: '/api/:rest*', destination: '/api-docs/:rest*' },
230-
];
207+
return [{ source: '/api/:rest*', destination: '/api-docs/:rest*' }];
231208
},
232209
// redirects only take effect in the development, not production (because of `next export`).
233210
redirects: async () => [

docs/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
"@mui/icons-material": "catalog:",
3030
"@mui/internal-core-docs": "catalog:",
3131
"@mui/internal-docs-infra": "^0.11.1-canary.15",
32-
"@mui/lab": "^9.0.0-beta.3",
32+
"@mui/lab": "^9.0.0-beta.5",
3333
"@mui/material": "catalog:",
34-
"@mui/material-nextjs": "^9.0.1",
34+
"@mui/material-nextjs": "^9.1.1",
3535
"@mui/stylis-plugin-rtl": "catalog:",
3636
"@mui/system": "catalog:",
3737
"@mui/utils": "catalog:",
@@ -95,7 +95,7 @@
9595
},
9696
"devDependencies": {
9797
"@babel/preset-typescript": "catalog:",
98-
"@mui/internal-docs-utils": "3.0.5-canary.1",
98+
"@mui/internal-docs-utils": "3.0.5-canary.2",
9999
"@types/chance": "catalog:",
100100
"@types/d3-scale-chromatic": "3.1.0",
101101
"@types/luxon": "catalog:",

docs/pages/_app.tsx

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'docs/src/bootstrap';
22
// --- Post bootstrap -----
33
import * as React from 'react';
4-
import type { DocsAppProps } from '@mui/internal-core-docs/DocsApp';
54
import {
65
DocsApp,
76
createGetInitialProps,
@@ -20,13 +19,7 @@ import xPages from 'docs/data/pages'; // DO NOT REMOVE
2019
import { postProcessImport } from 'docs/src/modules/utils/postProcessImport';
2120
import type { AppProps } from 'next/app';
2221
import { useRouter } from 'next/router';
23-
import {
24-
LANGUAGES,
25-
LANGUAGES_SSR,
26-
LANGUAGES_IGNORE_PAGES,
27-
LANGUAGES_IN_PROGRESS,
28-
} from '@mui/internal-core-docs/constants';
29-
import { DocsConfig } from '@mui/internal-core-docs/DocsProvider';
22+
import { DEFAULT_DOCS_CONFIG, DocsConfig } from '@mui/internal-core-docs/DocsProvider';
3023

3124
export { fontClasses } from '@mui/internal-core-docs/nextFonts';
3225

@@ -47,7 +40,7 @@ function getMuiPackageVersion(packageName: string, commitRef?: string) {
4740
return `https://pkg.pr.new/mui/mui-x/@mui/${packageName}@${commitRef}`;
4841
}
4942

50-
function usePageData(pageProps: DocsAppProps['pageProps']) {
43+
function usePageData() {
5144
const router = useRouter();
5245
const { productId: productIdRaw, productCategoryId } = getProductInfoFromUrl(router.asPath);
5346
const { canonicalAs } = pathnameToLanguage(router.asPath);
@@ -68,7 +61,6 @@ function usePageData(pageProps: DocsAppProps['pageProps']) {
6861

6962
return React.useMemo(() => {
7063
const { activePage, activePageParents } = findActivePage(xPages, router.pathname);
71-
const languagePrefix = pageProps.userLanguage === 'en' ? '' : `/${pageProps.userLanguage}`;
7264
const productIdMap: Record<string, { subpath: string; version: string | undefined }> = {
7365
introduction: { subpath: '/x/introduction', version: process.env.LIB_VERSION },
7466
'x-data-grid': { subpath: '/x/react-data-grid', version: process.env.DATA_GRID_VERSION },
@@ -88,12 +80,12 @@ function usePageData(pageProps: DocsAppProps['pageProps']) {
8880
return {
8981
current: true,
9082
text: `v${version}`,
91-
href: `${languagePrefix}${productIdMap[id].subpath}/`,
83+
href: `${productIdMap[id].subpath}/`,
9284
};
9385
}
9486
return {
9587
text: version,
96-
href: `https://${version}.mui.com${languagePrefix}${productIdMap[id].subpath}/`,
88+
href: `https://${version}.mui.com${productIdMap[id].subpath}/`,
9789
};
9890
});
9991

@@ -102,7 +94,7 @@ function usePageData(pageProps: DocsAppProps['pageProps']) {
10294
name: 'MUI X',
10395
versions: [
10496
...getVersionOptions('introduction', [process.env.LIB_VERSION!, 'v8', 'v7', 'v6', 'v5']),
105-
{ text: 'v4', href: `https://v4.mui.com${languagePrefix}/components/data-grid/` },
97+
{ text: 'v4', href: `https://v4.mui.com/components/data-grid/` },
10698
],
10799
};
108100

@@ -118,7 +110,7 @@ function usePageData(pageProps: DocsAppProps['pageProps']) {
118110
'v6',
119111
'v5',
120112
]),
121-
{ text: 'v4', href: `https://v4.mui.com${languagePrefix}/components/data-grid/` },
113+
{ text: 'v4', href: `https://v4.mui.com/components/data-grid/` },
122114
],
123115
};
124116
} else if (productId === 'x-date-pickers') {
@@ -134,7 +126,7 @@ function usePageData(pageProps: DocsAppProps['pageProps']) {
134126
]),
135127
{
136128
text: 'v5',
137-
href: `https://v5.mui.com${languagePrefix}/x/react-date-pickers/getting-started/`,
129+
href: `https://v5.mui.com/x/react-date-pickers/getting-started/`,
138130
},
139131
],
140132
};
@@ -152,7 +144,7 @@ function usePageData(pageProps: DocsAppProps['pageProps']) {
152144
...getVersionOptions('x-tree-view', [process.env.TREE_VIEW_VERSION!, 'v8', 'v7']),
153145
{
154146
text: 'v6',
155-
href: `https://v6.mui.com${languagePrefix}/x/react-tree-view/getting-started`,
147+
href: `https://v6.mui.com/x/react-tree-view/getting-started`,
156148
},
157149
],
158150
};
@@ -192,7 +184,7 @@ function usePageData(pageProps: DocsAppProps['pageProps']) {
192184
productId,
193185
productCategoryId,
194186
};
195-
}, [productId, productCategoryId, pageProps.userLanguage, router.pathname]);
187+
}, [productId, productCategoryId, router.pathname]);
196188
}
197189

198190
const CSB_CONFIG = {
@@ -246,10 +238,7 @@ const CSB_CONFIG = {
246238
};
247239

248240
const DOCS_CONFIG: DocsConfig = {
249-
LANGUAGES,
250-
LANGUAGES_SSR,
251-
LANGUAGES_IN_PROGRESS,
252-
LANGUAGES_IGNORE_PAGES,
241+
...DEFAULT_DOCS_CONFIG,
253242
};
254243

255244
function useThemeWrapper() {
@@ -264,7 +253,7 @@ export default function MyApp(
264253
) {
265254
const { Component, pageProps } = props;
266255
const { activePage, activePageParents, productIdentifier, productId, productCategoryId } =
267-
usePageData(pageProps);
256+
usePageData();
268257
const ThemeWrapper = useThemeWrapper();
269258

270259
return (
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react';
22
import { ApiPage } from '@mui/internal-core-docs/ApiPage';
3-
import { mapApiPageTranslations } from '@mui/internal-core-docs/mapApiPageTranslations';
3+
import { mapApiPageTranslation } from '@mui/internal-core-docs/mapApiPageTranslations';
4+
import translation from 'docs/translations/api-docs/charts/animated-area/animated-area.json';
45
import jsonPageContent from './animated-area.json';
56

67
export default function Page(props) {
@@ -9,12 +10,7 @@ export default function Page(props) {
910
}
1011

1112
export async function getStaticProps() {
12-
const req = require.context(
13-
'docs/translations/api-docs/charts/animated-area',
14-
false,
15-
/\.\/animated-area.*\.json$/,
16-
);
17-
const descriptions = mapApiPageTranslations(req);
13+
const descriptions = mapApiPageTranslation(translation);
1814

1915
return { props: { descriptions } };
2016
}
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react';
22
import { ApiPage } from '@mui/internal-core-docs/ApiPage';
3-
import { mapApiPageTranslations } from '@mui/internal-core-docs/mapApiPageTranslations';
3+
import { mapApiPageTranslation } from '@mui/internal-core-docs/mapApiPageTranslations';
4+
import translation from 'docs/translations/api-docs/charts/animated-line/animated-line.json';
45
import jsonPageContent from './animated-line.json';
56

67
export default function Page(props) {
@@ -9,12 +10,7 @@ export default function Page(props) {
910
}
1011

1112
export async function getStaticProps() {
12-
const req = require.context(
13-
'docs/translations/api-docs/charts/animated-line',
14-
false,
15-
/\.\/animated-line.*\.json$/,
16-
);
17-
const descriptions = mapApiPageTranslations(req);
13+
const descriptions = mapApiPageTranslation(translation);
1814

1915
return { props: { descriptions } };
2016
}
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react';
22
import { ApiPage } from '@mui/internal-core-docs/ApiPage';
3-
import { mapApiPageTranslations } from '@mui/internal-core-docs/mapApiPageTranslations';
3+
import { mapApiPageTranslation } from '@mui/internal-core-docs/mapApiPageTranslations';
4+
import translation from 'docs/translations/api-docs/charts/area-element/area-element.json';
45
import jsonPageContent from './area-element.json';
56

67
export default function Page(props) {
@@ -9,12 +10,7 @@ export default function Page(props) {
910
}
1011

1112
export async function getStaticProps() {
12-
const req = require.context(
13-
'docs/translations/api-docs/charts/area-element',
14-
false,
15-
/\.\/area-element.*\.json$/,
16-
);
17-
const descriptions = mapApiPageTranslations(req);
13+
const descriptions = mapApiPageTranslation(translation);
1814

1915
return { props: { descriptions } };
2016
}
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react';
22
import { ApiPage } from '@mui/internal-core-docs/ApiPage';
3-
import { mapApiPageTranslations } from '@mui/internal-core-docs/mapApiPageTranslations';
3+
import { mapApiPageTranslation } from '@mui/internal-core-docs/mapApiPageTranslations';
4+
import translation from 'docs/translations/api-docs/charts/area-plot/area-plot.json';
45
import jsonPageContent from './area-plot.json';
56

67
export default function Page(props) {
@@ -9,12 +10,7 @@ export default function Page(props) {
910
}
1011

1112
export async function getStaticProps() {
12-
const req = require.context(
13-
'docs/translations/api-docs/charts/area-plot',
14-
false,
15-
/\.\/area-plot.*\.json$/,
16-
);
17-
const descriptions = mapApiPageTranslations(req);
13+
const descriptions = mapApiPageTranslation(translation);
1814

1915
return { props: { descriptions } };
2016
}
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import * as React from 'react';
22
import InterfaceApiPage from 'docs/src/modules/components/InterfaceApiPage';
33
import layoutConfig from 'docs/src/modules/utils/dataGridLayoutConfig';
4-
import { mapApiPageTranslations } from '@mui/internal-core-docs/mapApiPageTranslations';
4+
import { mapApiPageTranslation } from '@mui/internal-core-docs/mapApiPageTranslations';
5+
import translation from 'docs/translations/api-docs/charts/axis-config.json';
56
import jsonPageContent from './axis-config.json';
67

78
export default function Page(props) {
@@ -12,11 +13,6 @@ export default function Page(props) {
1213
}
1314

1415
export async function getStaticProps() {
15-
const req = require.context(
16-
'docs/translations/api-docs/charts/',
17-
false,
18-
/\.\/axis-config.*.json$/,
19-
);
20-
const descriptions = mapApiPageTranslations(req);
16+
const descriptions = mapApiPageTranslation(translation);
2117
return { props: { descriptions } };
2218
}
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react';
22
import { ApiPage } from '@mui/internal-core-docs/ApiPage';
3-
import { mapApiPageTranslations } from '@mui/internal-core-docs/mapApiPageTranslations';
3+
import { mapApiPageTranslation } from '@mui/internal-core-docs/mapApiPageTranslations';
4+
import translation from 'docs/translations/api-docs/charts/bar-chart-premium/bar-chart-premium.json';
45
import jsonPageContent from './bar-chart-premium.json';
56

67
export default function Page(props) {
@@ -9,12 +10,7 @@ export default function Page(props) {
910
}
1011

1112
export async function getStaticProps() {
12-
const req = require.context(
13-
'docs/translations/api-docs/charts/bar-chart-premium',
14-
false,
15-
/\.\/bar-chart-premium.*\.json$/,
16-
);
17-
const descriptions = mapApiPageTranslations(req);
13+
const descriptions = mapApiPageTranslation(translation);
1814

1915
return { props: { descriptions } };
2016
}
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react';
22
import { ApiPage } from '@mui/internal-core-docs/ApiPage';
3-
import { mapApiPageTranslations } from '@mui/internal-core-docs/mapApiPageTranslations';
3+
import { mapApiPageTranslation } from '@mui/internal-core-docs/mapApiPageTranslations';
4+
import translation from 'docs/translations/api-docs/charts/bar-chart-pro/bar-chart-pro.json';
45
import jsonPageContent from './bar-chart-pro.json';
56

67
export default function Page(props) {
@@ -9,12 +10,7 @@ export default function Page(props) {
910
}
1011

1112
export async function getStaticProps() {
12-
const req = require.context(
13-
'docs/translations/api-docs/charts/bar-chart-pro',
14-
false,
15-
/\.\/bar-chart-pro.*\.json$/,
16-
);
17-
const descriptions = mapApiPageTranslations(req);
13+
const descriptions = mapApiPageTranslation(translation);
1814

1915
return { props: { descriptions } };
2016
}

0 commit comments

Comments
 (0)