Skip to content

Commit

Permalink
Docs config
Browse files Browse the repository at this point in the history
  • Loading branch information
Janpot committed Feb 1, 2024
1 parent c4103ed commit e5833b0
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 43 deletions.
8 changes: 1 addition & 7 deletions docs/config.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
export const LANGUAGES: string[];

export const LANGUAGES_SSR: string[];

export const LANGUAGES_IN_PROGRESS: string[];

export const LANGUAGES_IGNORE_PAGES: (pathname: string) => boolean;
export * from '@mui/docs/config';
30 changes: 1 addition & 29 deletions docs/config.js
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
// Valid languages to server-side render in production
const LANGUAGES = ['en'];

// Server side rendered languages
const LANGUAGES_SSR = ['en'];

// Work in progress
const LANGUAGES_IN_PROGRESS = LANGUAGES.slice();

const LANGUAGES_IGNORE_PAGES = (pathname) => {
// We don't have the bandwidth like Qt to translate our blog posts
// https://www.qt.io/zh-cn/blog
if (pathname === '/blog' || pathname.startsWith('/blog/')) {
return true;
}

if (pathname === '/size-snapshot/') {
return true;
}

return false;
};

module.exports = {
LANGUAGES,
LANGUAGES_IN_PROGRESS,
LANGUAGES_SSR,
LANGUAGES_IGNORE_PAGES,
};
module.exports = require('@mui/docs/config');
2 changes: 1 addition & 1 deletion docs/src/modules/components/AppSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import NewspaperRoundedIcon from '@mui/icons-material/NewspaperRounded';
import GlobalStyles from '@mui/material/GlobalStyles';
import { alpha, styled } from '@mui/material/styles';
import { pathnameToLanguage } from 'docs/src/modules/utils/helpers';
import { LANGUAGES_SSR } from 'docs/config';
import { LANGUAGES_SSR } from '@mui/docs/config';
import Link from 'docs/src/modules/components/Link';
import { useTranslate, useUserLanguage } from '@mui/docs/i18n';
import useLazyCSS from 'docs/src/modules/utils/useLazyCSS';
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/components/Head.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import NextHead from 'next/head';
import { useRouter } from 'next/router';
import { LANGUAGES_SSR } from 'docs/config';
import { LANGUAGES_SSR } from '@mui/docs/config';
import { useUserLanguage, useTranslate } from '@mui/docs/i18n';
import { pathnameToLanguage } from 'docs/src/modules/utils/helpers';

Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/utils/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import upperFirst from 'lodash/upperFirst';
import camelCase from 'lodash/camelCase';
import { LANGUAGES } from 'docs/config';
import { LANGUAGES } from '@mui/docs/config';

function pascalCase(str: string) {
return upperFirst(camelCase(str));
Expand Down
2 changes: 1 addition & 1 deletion packages/api-docs-builder-core/baseUi/projectSettings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path';
import { LANGUAGES } from 'docs/config';
import { LANGUAGES } from '@mui/docs/config';
import { ProjectSettings } from '@mui-internal/api-docs-builder';
import findApiPages from '@mui-internal/api-docs-builder/utils/findApiPages';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/api-docs-builder-core/joyUi/projectSettings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path';
import { LANGUAGES } from 'docs/config';
import { LANGUAGES } from '@mui/docs/config';
import { ProjectSettings } from '@mui-internal/api-docs-builder';
import findApiPages from '@mui-internal/api-docs-builder/utils/findApiPages';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path';
import { LANGUAGES } from 'docs/config';
import { LANGUAGES } from '@mui/docs/config';
import { ProjectSettings } from '@mui-internal/api-docs-builder';
import findApiPages from '@mui-internal/api-docs-builder/utils/findApiPages';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path';
import { LANGUAGES } from 'docs/config';
import { LANGUAGES } from '@mui/docs/config';
import { ProjectSettings } from '@mui-internal/api-docs-builder';
import findApiPages from '@mui-internal/api-docs-builder/utils/findApiPages';
import {
Expand Down
1 change: 1 addition & 0 deletions packages/api-docs-builder-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"typescript": "tsc -p tsconfig.json"
},
"dependencies": {
"@mui/docs": "workspace:^",
"@mui-internal/api-docs-builder": "workspace:^",
"@mui/markdown": "workspace:^",
"docs": "workspace:^",
Expand Down
7 changes: 7 additions & 0 deletions packages/mui-docs/src/config/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const LANGUAGES: string[];

export const LANGUAGES_SSR: string[];

export const LANGUAGES_IN_PROGRESS: string[];

export const LANGUAGES_IGNORE_PAGES: (pathname: string) => boolean;
29 changes: 29 additions & 0 deletions packages/mui-docs/src/config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Valid languages to server-side render in production
const LANGUAGES = ['en'];

// Server side rendered languages
const LANGUAGES_SSR = ['en'];

// Work in progress
const LANGUAGES_IN_PROGRESS = LANGUAGES.slice();

const LANGUAGES_IGNORE_PAGES = (pathname) => {
// We don't have the bandwidth like Qt to translate our blog posts
// https://www.qt.io/zh-cn/blog
if (pathname === '/blog' || pathname.startsWith('/blog/')) {
return true;
}

if (pathname === '/size-snapshot/') {
return true;
}

return false;
};

module.exports = {
LANGUAGES,
LANGUAGES_IN_PROGRESS,
LANGUAGES_SSR,
LANGUAGES_IGNORE_PAGES,
};
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e5833b0

Please sign in to comment.