Skip to content

Commit b6cdf15

Browse files
authored
Update to new embedded translations in the docs package (#12232)
1 parent f617d70 commit b6cdf15

File tree

3 files changed

+10
-195
lines changed

3 files changed

+10
-195
lines changed

docs/pages/_app.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import findActivePage from 'docs/src/modules/utils/findActivePage';
2020
import { LicenseInfo } from '@mui/x-license';
2121
import getProductInfoFromUrl from 'docs/src/modules/utils/getProductInfoFromUrl';
2222
import { DocsProvider } from '@mui/docs/DocsProvider';
23+
import { mapTranslations } from '@mui/docs/i18n';
2324
import config from '../config';
2425

2526
// Remove the license warning from demonstration purposes
@@ -307,7 +308,11 @@ function AppWrapper(props) {
307308
<meta name="mui:productId" content={productId} />
308309
<meta name="mui:productCategoryId" content={productCategoryId} />
309310
</NextHead>
310-
<DocsProvider config={config} defaultUserLanguage={pageProps.userLanguage}>
311+
<DocsProvider
312+
config={config}
313+
defaultUserLanguage={pageProps.userLanguage}
314+
translations={pageProps.translations}
315+
>
311316
<CodeCopyProvider>
312317
<CodeVariantProvider>
313318
<PageContext.Provider value={pageContextValue}>
@@ -350,13 +355,17 @@ MyApp.propTypes = {
350355
MyApp.getInitialProps = async ({ ctx, Component }) => {
351356
let pageProps = {};
352357

358+
const req = require.context('../translations', false, /\.\/translations.*\.json$/);
359+
const translations = mapTranslations(req);
360+
353361
if (Component.getInitialProps) {
354362
pageProps = await Component.getInitialProps(ctx);
355363
}
356364

357365
return {
358366
pageProps: {
359367
userLanguage: ctx.query.userLanguage || 'en',
368+
translations,
360369
...pageProps,
361370
},
362371
};

docs/translations/translations-zh.json

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,4 @@
11
{
2-
"adblock": "如果您不介意与技术相关的广告,并且支持开源代码,请在你的 ad blocker 中将 MUI 设置为白名单。",
3-
"albumDescr": "这是一个包含了 hero 的单元和页脚的响应式相册 / 展览页面布局。",
4-
"albumTitle": "相册",
5-
"algoliaSearch": "搜索",
6-
"blogDescr": "这是一个精致的博客页面布局。这个 Markdown 由 markdown-to-jsx 提供支持,但是这也不难替换。",
7-
"blogTitle": "博客",
8-
"cdn": "或者您也可以使用 CDN。",
9-
"changeLanguage": "更改语言",
10-
"checkoutDescr": "这是一个逐步建立的支付页面布局。您可以根据具体需求来调整步骤,或者只采用部分步骤。",
11-
"checkoutTitle": "支付",
12-
"close": "关闭",
13-
"codesandbox": "在 CodeSandbox 中编辑",
14-
"copiedSource": "源代码已被复制。",
15-
"copiedSourceLink": "源代码的链接已被复制。",
16-
"copySource": "复制源代码",
17-
"copySourceLinkJS": "请将链接复制到 JavaScript 源代码",
18-
"copySourceLinkTS": "请将链接复制到 TypeScript 源代码",
19-
"dashboardDescr": "这是一个含有任务栏和迷你变体抽屉的最小化管理面板。这个图表由 Recharts 提供,但是很容易替换成其他的。",
20-
"dashboardTitle": "管理面板",
21-
"decreaseSpacing": "减少间距",
22-
"demoToolbarLabel": "demo 源",
23-
"diamondSponsors": "钻石赞助商",
24-
"editPage": "编辑此页面",
25-
"editWebsiteColors": "编辑网站的颜色",
26-
"emojiLove": "喜爱",
27-
"emoojiWarning": "警告",
28-
"expandAll": "展开全部",
29-
"footerCommunity": "社区",
30-
"footerCompany": "企业",
31-
"footerResources": "资源",
32-
"getProfessionalSupport": "获取专业客服",
33-
"getStarted": "快速上手",
34-
"github": "GitHub 存储库",
35-
"headTitle": "MUI:当下流行的 React UI 框架",
36-
"helpToTranslate": "来帮助我们翻译吧",
37-
"hideFullSource": "隐藏全部源代码",
38-
"hideSource": "隐藏源代码",
39-
"homeFooterRelease": "当前版本为 {{versionNumber}}。在 {{license}} 下发布。",
40-
"homeQuickWord": "来自我们的赞助商的一个简短概括:",
41-
"increaseSpacing": "增加间距",
42-
"installation": "安装",
43-
"installButton": "阅读安装文档",
44-
"installDescr": "您可以通过 npm 安装 MUI 的源码。我们会负责引入样式。",
45-
"joinThese": "一起加入这些或者其他的有名的组织中吧!",
46-
"letUsKnow": "请告诉我们吧!",
47-
"license": "MIT 许可证",
48-
"likeMui": "请帮助我们继续运行把",
49-
"loadFont": "加载默认的 Roboto 字体。",
50-
"mainNavigation": "主导航",
51-
"newest": "最新的",
52-
"openDrawer": "打开主导航栏",
53-
"pageTOC": "目录内容的页面",
54-
"praise": "给 MUI 点赞",
55-
"praiseDescr": "以下是一些我们用户的看法。",
56-
"pricingDescr": "使用此页面布局,您可以快速的为潜在客户创建一个高效的价格表。",
57-
"pricingTitle": "定价",
58-
"resetDemo": "重置 demo",
59-
"resetDensity": "重置密度",
60-
"seeMore": "查看更多",
61-
"showFullSource": "显示全部源代码",
62-
"showJSSource": "显示 JavaScript 源代码",
63-
"showSource": "查看源代码",
64-
"showTSSource": "显示 TypeScript 源代码",
65-
"signInDescr": "这是一个简单的登录页面。",
66-
"signInSideDescr": "一个简单的侧边登录页面",
67-
"signInSideTitle": "侧边页登录",
68-
"signInTitle": "登录",
69-
"signUpDescr": "一个简单的注册页面",
70-
"signUpTitle": "注册",
71-
"skipToContent": "跳转到内容",
72-
"sourceCode": "源代码",
73-
"spacingUnit": "间隔单元",
74-
"stackblitz": "在 StackBlitz 中编辑(仅限JS)",
75-
"stars": "GitHub 点赞数",
76-
"stickyFooterDescr": "当页面内容比较简短的时候,在可视区域的底端附加上一个页脚。",
77-
"stickyFooterTitle": "Sticky footer",
78-
"strapline": "React 组件用于更快速、更简便的 web 开发。你也可以建立你自己的设计系统,或者从 Material Design 开始。",
79-
"tableOfContents": "目录",
80-
"thanks": "感谢!",
81-
"themes": "高级版主题",
82-
"themesButton": "浏览主题",
83-
"themesDescr": "试一试我们的商城中的高级主题吧——它们均以 MUI 为基础,它们可以让你的项目更上一层楼。",
84-
"toggleNotifications": "切换通知面板",
85-
"toggleRTL": "从右到左 / 从左到右切换 ",
86-
"toggleTheme": "在light(亮色)和dark(暗色)主题中切换",
87-
"traffic": "流量",
88-
"usage": "使用",
89-
"usageButton": "探索文档",
90-
"usageDescr": "MUI 组件无需任何额外的设置即可使用,并且不会影响全局变量。",
91-
"useDarkTheme": "使用暗色主题",
92-
"useHighDensity": "通过 props 来实现更高的密度值",
93-
"usingMui": "您在使用 MUI 吗?",
94-
"viewGitHub": "在 GitHub 中查看源代码",
95-
"visit": "访问网站",
96-
"whosUsing": "谁在使用 MUI 呢?",
97-
"initialFocusLabel": "一个旨在测试我们的组件的键盘导航功能的程序化的通用容器",
98-
"resetFocus": "重置焦点以测试键盘导航功能",
992
"pages": {
1003
"/getting-started": "快速上手",
1014
"/getting-started/installation": "安装",

docs/translations/translations.json

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,4 @@
11
{
2-
"adblock": "If you don't mind tech related ads (no tracking or remarketing), and want to keep us running, please whitelist MUI in your blocker.",
3-
"albumDescr": "A responsive album / gallery page layout with a hero unit and footer.",
4-
"albumTitle": "Album",
5-
"algoliaSearch": "Search",
6-
"blogDescr": "A sophisticated blog page layout. Markdown support is courtesy of markdown-to-jsx but is easily replaced.",
7-
"blogTitle": "Blog",
8-
"cdn": "or use a CDN.",
9-
"changeLanguage": "Change language",
10-
"checkoutDescr": "A step-by-step checkout page layout. Adapt the number of steps to suit your needs, or make steps optional.",
11-
"checkoutTitle": "Checkout",
12-
"close": "Close",
13-
"codesandbox": "Edit in CodeSandbox",
14-
"copiedSource": "The source code has been copied.",
15-
"copiedSourceLink": "Link to the source code has been copied.",
16-
"copySource": "Copy the source",
17-
"copySourceLinkJS": "Copy link to JavaScript source",
18-
"copySourceLinkTS": "Copy link to TypeScript source",
19-
"dashboardDescr": "A minimal dashboard with taskbar and mini variant draw. The chart is courtesy of Recharts, but it is simple to substitute an alternative.",
20-
"dashboardTitle": "Dashboard",
21-
"decreaseSpacing": "decrease spacing",
22-
"demoToolbarLabel": "demo source",
23-
"diamondSponsors": "Diamond Sponsors",
24-
"editPage": "Edit this page",
25-
"editWebsiteColors": "Edit website colors",
26-
"emojiLove": "Love",
27-
"emoojiWarning": "Warning",
28-
"expandAll": "Expand all",
29-
"footerCommunity": "Community",
30-
"footerCompany": "Company",
31-
"footerResources": "Resources",
32-
"getProfessionalSupport": "Get Professional Support",
33-
"getStarted": "Get Started",
34-
"github": "GitHub repository",
35-
"headTitle": "MUI: A popular React UI framework",
36-
"helpToTranslate": "Help to translate",
37-
"hideFullSource": "Hide the full source",
38-
"hideSource": "Hide the source",
39-
"homeFooterRelease": "Currently {{versionNumber}}. Released under the {{license}}.",
40-
"homeQuickWord": "A quick word from our sponsors:",
41-
"increaseSpacing": "increase spacing",
42-
"installation": "Installation",
43-
"installButton": "Read installation docs",
44-
"installDescr": "Install MUI's source files via npm. We take care of injecting the CSS needed.",
45-
"joinThese": "Join these and other great organisations!",
46-
"letUsKnow": "Let us know!",
47-
"license": "MIT License",
48-
"likeMui": "Help us keep running",
49-
"loadFont": "Load the default Roboto font.",
50-
"mainNavigation": "Main navigation",
51-
"newest": "Newest",
52-
"openDrawer": "Open main navigation",
53-
"pageTOC": "Page table of contents",
54-
"praise": "Praise for MUI",
55-
"praiseDescr": "Here's what some of our users are saying.",
56-
"pricingDescr": "Quickly build an effective pricing table for your potential customers with this page layout.",
57-
"pricingTitle": "Pricing",
58-
"resetDemo": "Reset demo",
59-
"resetDensity": "Reset density",
60-
"seeMore": "See more",
61-
"showFullSource": "Show the full source",
62-
"showJSSource": "Show JavaScript source",
63-
"showSource": "Show the source",
64-
"showTSSource": "Show TypeScript source",
65-
"signInDescr": "A simple Sign In page.",
66-
"signInSideDescr": "A simple Sign In side page.",
67-
"signInSideTitle": "Sign-in side",
68-
"signInTitle": "Sign In",
69-
"signUpDescr": "A simple Sign Up page.",
70-
"signUpTitle": "Sign Up",
71-
"skipToContent": "Skip to content",
72-
"sourceCode": "Source code",
73-
"spacingUnit": "Spacing unit",
74-
"stackblitz": "Edit in StackBlitz (JS only)",
75-
"stars": "GitHub stars",
76-
"stickyFooterDescr": "Attach a footer to the bottom of the viewport when page content is short.",
77-
"stickyFooterTitle": "Sticky footer",
78-
"strapline": "React components for faster and easier web development. Build your own design system, or start with Material Design.",
79-
"tableOfContents": "Contents",
80-
"thanks": "Thank you!",
81-
"themes": "Premium themes",
82-
"themesButton": "Browse themes",
83-
"themesDescr": "Take your project to the next level with premium themes from our store – all built on MUI.",
84-
"toggleNotifications": "Toggle notifications panel",
85-
"toggleRTL": "Toggle right-to-left/left-to-right",
86-
"toggleTheme": "Toggle light/dark theme",
87-
"traffic": "Traffic",
88-
"usage": "Usage",
89-
"usageButton": "Explore the docs",
90-
"usageDescr": "MUI components work without any additional setup, and don't pollute the global scope.",
91-
"useDarkTheme": "Use dark theme",
92-
"useHighDensity": "Apply higher density via props",
93-
"usingMui": "Are you using MUI?",
94-
"viewGitHub": "View the source on GitHub",
95-
"visit": "Visit the website",
96-
"whosUsing": "Who's using MUI?",
97-
"initialFocusLabel": "A generic container that is programmatically focused to test keyboard navigation of our components.",
98-
"resetFocus": "Reset focus to test keyboard navigation",
992
"pages": {
1003
"/getting-started": "Getting Started",
1014
"/getting-started/installation": "Installation",

0 commit comments

Comments
 (0)