Skip to content

Commit

Permalink
[docs] Disable translations (mui#6560)
Browse files Browse the repository at this point in the history
  • Loading branch information
cherniavskii committed Oct 26, 2022
1 parent 8383700 commit 9d66431
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 58 deletions.
1 change: 0 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"@types/lodash": "^4.14.184",
"@types/react-dom": "^18.0.6",
"@types/react-router-dom": "^5.3.3",
"accept-language": "^3.0.18",
"address": "^1.2.0",
"ast-types": "^0.14.2",
"autoprefixer": "^10.4.8",
Expand Down
40 changes: 1 addition & 39 deletions docs/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,14 @@ import * as React from 'react';
import { loadCSS } from 'fg-loadcss/src/loadCSS';
import NextHead from 'next/head';
import PropTypes from 'prop-types';
import acceptLanguage from 'accept-language';
import { useRouter } from 'next/router';
import { ponyfillGlobal } from '@mui/utils';
import PageContext from 'docs/src/modules/components/PageContext';
import GoogleAnalytics from 'docs/src/modules/components/GoogleAnalytics';
import { ThemeProvider } from 'docs/src/modules/components/ThemeContext';
import { pathnameToLanguage, getCookie } from 'docs/src/modules/utils/helpers';
import { LANGUAGES } from 'docs/src/modules/constants';
import { CodeVariantProvider } from 'docs/src/modules/utils/codeVariant';
import { CodeCopyProvider } from 'docs/src/modules/utils/CodeCopy';
import {
UserLanguageProvider,
useSetUserLanguage,
useUserLanguage,
} from 'docs/src/modules/utils/i18n';
import { UserLanguageProvider } from 'docs/src/modules/utils/i18n';
import DocsStyledEngineProvider from 'docs/src/modules/utils/StyledEngineProvider';
import createEmotionCache from 'docs/src/createEmotionCache';
import findActivePage from 'docs/src/modules/utils/findActivePage';
Expand Down Expand Up @@ -92,36 +85,6 @@ ponyfillGlobal.muiDocConfig = {
// Client-side cache, shared for the whole session of the user in the browser.
const clientSideEmotionCache = createEmotionCache();

// Set the locales that the documentation automatically redirects to.
acceptLanguage.languages(LANGUAGES);

function LanguageNegotiation() {
const setUserLanguage = useSetUserLanguage();
const router = useRouter();
const userLanguage = useUserLanguage();

React.useEffect(() => {
const { userLanguage: userLanguageUrl, canonicalAs } = pathnameToLanguage(router.asPath);
const preferedLanguage =
LANGUAGES.find((lang) => lang === getCookie('userLanguage')) ||
acceptLanguage.get(navigator.language) ||
userLanguage;

if (
userLanguageUrl === 'en' &&
userLanguage !== preferedLanguage &&
!process.env.PULL_REQUEST
) {
window.location =
preferedLanguage === 'en' ? canonicalAs : `/${preferedLanguage}${canonicalAs}`;
} else if (userLanguage !== userLanguageUrl) {
setUserLanguage(userLanguageUrl);
}
}, []); // eslint-disable-line react-hooks/exhaustive-deps

return null;
}

let reloadInterval;

// Avoid infinite loop when "Upload on reload" is set in the Chrome sw dev tools.
Expand Down Expand Up @@ -265,7 +228,6 @@ function AppWrapper(props) {
</DocsStyledEngineProvider>
</ThemeProvider>
</PageContext.Provider>
<LanguageNegotiation />
</CodeVariantProvider>
</CodeCopyProvider>
</UserLanguageProvider>
Expand Down
18 changes: 0 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4184,14 +4184,6 @@ abort-controller@^3.0.0:
dependencies:
event-target-shim "^5.0.0"

accept-language@^3.0.18:
version "3.0.18"
resolved "https://registry.yarnpkg.com/accept-language/-/accept-language-3.0.18.tgz#f5025f17bf65a466a845838ccf98cdb877d83384"
integrity sha1-9QJfF79lpGaoRYOMz5jNuHfYM4Q=
dependencies:
bcp47 "^1.1.2"
stable "^0.1.6"

accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8:
version "1.3.8"
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e"
Expand Down Expand Up @@ -4936,11 +4928,6 @@ [email protected], base64id@~2.0.0:
resolved "https://registry.yarnpkg.com/base64id/-/base64id-2.0.0.tgz#2770ac6bc47d312af97a8bf9a634342e0cd25cb6"
integrity sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==

bcp47@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/bcp47/-/bcp47-1.1.2.tgz#354be3307ffd08433a78f5e1e2095845f89fc7fe"
integrity sha1-NUvjMH/9CEM6ePXh4glYRfifx/4=

bcrypt-pbkdf@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e"
Expand Down Expand Up @@ -13306,11 +13293,6 @@ ssri@^9.0.0, ssri@^9.0.1:
dependencies:
minipass "^3.1.1"

stable@^0.1.6:
version "0.1.8"
resolved "https://registry.yarnpkg.com/stable/-/stable-0.1.8.tgz#836eb3c8382fe2936feaf544631017ce7d47a3cf"
integrity sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==

[email protected], stack-utils@^2.0.3:
version "2.0.5"
resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.5.tgz#d25265fca995154659dbbfba3b49254778d2fdd5"
Expand Down

0 comments on commit 9d66431

Please sign in to comment.