Skip to content

Commit

Permalink
Update to new embedded translations in the docs package (#12232)
Browse files Browse the repository at this point in the history
  • Loading branch information
Janpot authored Apr 4, 2024
1 parent f617d70 commit b6cdf15
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 195 deletions.
11 changes: 10 additions & 1 deletion docs/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import findActivePage from 'docs/src/modules/utils/findActivePage';
import { LicenseInfo } from '@mui/x-license';
import getProductInfoFromUrl from 'docs/src/modules/utils/getProductInfoFromUrl';
import { DocsProvider } from '@mui/docs/DocsProvider';
import { mapTranslations } from '@mui/docs/i18n';
import config from '../config';

// Remove the license warning from demonstration purposes
Expand Down Expand Up @@ -307,7 +308,11 @@ function AppWrapper(props) {
<meta name="mui:productId" content={productId} />
<meta name="mui:productCategoryId" content={productCategoryId} />
</NextHead>
<DocsProvider config={config} defaultUserLanguage={pageProps.userLanguage}>
<DocsProvider
config={config}
defaultUserLanguage={pageProps.userLanguage}
translations={pageProps.translations}
>
<CodeCopyProvider>
<CodeVariantProvider>
<PageContext.Provider value={pageContextValue}>
Expand Down Expand Up @@ -350,13 +355,17 @@ MyApp.propTypes = {
MyApp.getInitialProps = async ({ ctx, Component }) => {
let pageProps = {};

const req = require.context('../translations', false, /\.\/translations.*\.json$/);
const translations = mapTranslations(req);

if (Component.getInitialProps) {
pageProps = await Component.getInitialProps(ctx);
}

return {
pageProps: {
userLanguage: ctx.query.userLanguage || 'en',
translations,
...pageProps,
},
};
Expand Down
97 changes: 0 additions & 97 deletions docs/translations/translations-zh.json
Original file line number Diff line number Diff line change
@@ -1,101 +1,4 @@
{
"adblock": "如果您不介意与技术相关的广告,并且支持开源代码,请在你的 ad blocker 中将 MUI 设置为白名单。",
"albumDescr": "这是一个包含了 hero 的单元和页脚的响应式相册 / 展览页面布局。",
"albumTitle": "相册",
"algoliaSearch": "搜索",
"blogDescr": "这是一个精致的博客页面布局。这个 Markdown 由 markdown-to-jsx 提供支持,但是这也不难替换。",
"blogTitle": "博客",
"cdn": "或者您也可以使用 CDN。",
"changeLanguage": "更改语言",
"checkoutDescr": "这是一个逐步建立的支付页面布局。您可以根据具体需求来调整步骤,或者只采用部分步骤。",
"checkoutTitle": "支付",
"close": "关闭",
"codesandbox": "在 CodeSandbox 中编辑",
"copiedSource": "源代码已被复制。",
"copiedSourceLink": "源代码的链接已被复制。",
"copySource": "复制源代码",
"copySourceLinkJS": "请将链接复制到 JavaScript 源代码",
"copySourceLinkTS": "请将链接复制到 TypeScript 源代码",
"dashboardDescr": "这是一个含有任务栏和迷你变体抽屉的最小化管理面板。这个图表由 Recharts 提供,但是很容易替换成其他的。",
"dashboardTitle": "管理面板",
"decreaseSpacing": "减少间距",
"demoToolbarLabel": "demo 源",
"diamondSponsors": "钻石赞助商",
"editPage": "编辑此页面",
"editWebsiteColors": "编辑网站的颜色",
"emojiLove": "喜爱",
"emoojiWarning": "警告",
"expandAll": "展开全部",
"footerCommunity": "社区",
"footerCompany": "企业",
"footerResources": "资源",
"getProfessionalSupport": "获取专业客服",
"getStarted": "快速上手",
"github": "GitHub 存储库",
"headTitle": "MUI:当下流行的 React UI 框架",
"helpToTranslate": "来帮助我们翻译吧",
"hideFullSource": "隐藏全部源代码",
"hideSource": "隐藏源代码",
"homeFooterRelease": "当前版本为 {{versionNumber}}。在 {{license}} 下发布。",
"homeQuickWord": "来自我们的赞助商的一个简短概括:",
"increaseSpacing": "增加间距",
"installation": "安装",
"installButton": "阅读安装文档",
"installDescr": "您可以通过 npm 安装 MUI 的源码。我们会负责引入样式。",
"joinThese": "一起加入这些或者其他的有名的组织中吧!",
"letUsKnow": "请告诉我们吧!",
"license": "MIT 许可证",
"likeMui": "请帮助我们继续运行把",
"loadFont": "加载默认的 Roboto 字体。",
"mainNavigation": "主导航",
"newest": "最新的",
"openDrawer": "打开主导航栏",
"pageTOC": "目录内容的页面",
"praise": "给 MUI 点赞",
"praiseDescr": "以下是一些我们用户的看法。",
"pricingDescr": "使用此页面布局,您可以快速的为潜在客户创建一个高效的价格表。",
"pricingTitle": "定价",
"resetDemo": "重置 demo",
"resetDensity": "重置密度",
"seeMore": "查看更多",
"showFullSource": "显示全部源代码",
"showJSSource": "显示 JavaScript 源代码",
"showSource": "查看源代码",
"showTSSource": "显示 TypeScript 源代码",
"signInDescr": "这是一个简单的登录页面。",
"signInSideDescr": "一个简单的侧边登录页面",
"signInSideTitle": "侧边页登录",
"signInTitle": "登录",
"signUpDescr": "一个简单的注册页面",
"signUpTitle": "注册",
"skipToContent": "跳转到内容",
"sourceCode": "源代码",
"spacingUnit": "间隔单元",
"stackblitz": "在 StackBlitz 中编辑(仅限JS)",
"stars": "GitHub 点赞数",
"stickyFooterDescr": "当页面内容比较简短的时候,在可视区域的底端附加上一个页脚。",
"stickyFooterTitle": "Sticky footer",
"strapline": "React 组件用于更快速、更简便的 web 开发。你也可以建立你自己的设计系统,或者从 Material Design 开始。",
"tableOfContents": "目录",
"thanks": "感谢!",
"themes": "高级版主题",
"themesButton": "浏览主题",
"themesDescr": "试一试我们的商城中的高级主题吧——它们均以 MUI 为基础,它们可以让你的项目更上一层楼。",
"toggleNotifications": "切换通知面板",
"toggleRTL": "从右到左 / 从左到右切换 ",
"toggleTheme": "在light(亮色)和dark(暗色)主题中切换",
"traffic": "流量",
"usage": "使用",
"usageButton": "探索文档",
"usageDescr": "MUI 组件无需任何额外的设置即可使用,并且不会影响全局变量。",
"useDarkTheme": "使用暗色主题",
"useHighDensity": "通过 props 来实现更高的密度值",
"usingMui": "您在使用 MUI 吗?",
"viewGitHub": "在 GitHub 中查看源代码",
"visit": "访问网站",
"whosUsing": "谁在使用 MUI 呢?",
"initialFocusLabel": "一个旨在测试我们的组件的键盘导航功能的程序化的通用容器",
"resetFocus": "重置焦点以测试键盘导航功能",
"pages": {
"/getting-started": "快速上手",
"/getting-started/installation": "安装",
Expand Down
97 changes: 0 additions & 97 deletions docs/translations/translations.json
Original file line number Diff line number Diff line change
@@ -1,101 +1,4 @@
{
"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.",
"albumDescr": "A responsive album / gallery page layout with a hero unit and footer.",
"albumTitle": "Album",
"algoliaSearch": "Search",
"blogDescr": "A sophisticated blog page layout. Markdown support is courtesy of markdown-to-jsx but is easily replaced.",
"blogTitle": "Blog",
"cdn": "or use a CDN.",
"changeLanguage": "Change language",
"checkoutDescr": "A step-by-step checkout page layout. Adapt the number of steps to suit your needs, or make steps optional.",
"checkoutTitle": "Checkout",
"close": "Close",
"codesandbox": "Edit in CodeSandbox",
"copiedSource": "The source code has been copied.",
"copiedSourceLink": "Link to the source code has been copied.",
"copySource": "Copy the source",
"copySourceLinkJS": "Copy link to JavaScript source",
"copySourceLinkTS": "Copy link to TypeScript source",
"dashboardDescr": "A minimal dashboard with taskbar and mini variant draw. The chart is courtesy of Recharts, but it is simple to substitute an alternative.",
"dashboardTitle": "Dashboard",
"decreaseSpacing": "decrease spacing",
"demoToolbarLabel": "demo source",
"diamondSponsors": "Diamond Sponsors",
"editPage": "Edit this page",
"editWebsiteColors": "Edit website colors",
"emojiLove": "Love",
"emoojiWarning": "Warning",
"expandAll": "Expand all",
"footerCommunity": "Community",
"footerCompany": "Company",
"footerResources": "Resources",
"getProfessionalSupport": "Get Professional Support",
"getStarted": "Get Started",
"github": "GitHub repository",
"headTitle": "MUI: A popular React UI framework",
"helpToTranslate": "Help to translate",
"hideFullSource": "Hide the full source",
"hideSource": "Hide the source",
"homeFooterRelease": "Currently {{versionNumber}}. Released under the {{license}}.",
"homeQuickWord": "A quick word from our sponsors:",
"increaseSpacing": "increase spacing",
"installation": "Installation",
"installButton": "Read installation docs",
"installDescr": "Install MUI's source files via npm. We take care of injecting the CSS needed.",
"joinThese": "Join these and other great organisations!",
"letUsKnow": "Let us know!",
"license": "MIT License",
"likeMui": "Help us keep running",
"loadFont": "Load the default Roboto font.",
"mainNavigation": "Main navigation",
"newest": "Newest",
"openDrawer": "Open main navigation",
"pageTOC": "Page table of contents",
"praise": "Praise for MUI",
"praiseDescr": "Here's what some of our users are saying.",
"pricingDescr": "Quickly build an effective pricing table for your potential customers with this page layout.",
"pricingTitle": "Pricing",
"resetDemo": "Reset demo",
"resetDensity": "Reset density",
"seeMore": "See more",
"showFullSource": "Show the full source",
"showJSSource": "Show JavaScript source",
"showSource": "Show the source",
"showTSSource": "Show TypeScript source",
"signInDescr": "A simple Sign In page.",
"signInSideDescr": "A simple Sign In side page.",
"signInSideTitle": "Sign-in side",
"signInTitle": "Sign In",
"signUpDescr": "A simple Sign Up page.",
"signUpTitle": "Sign Up",
"skipToContent": "Skip to content",
"sourceCode": "Source code",
"spacingUnit": "Spacing unit",
"stackblitz": "Edit in StackBlitz (JS only)",
"stars": "GitHub stars",
"stickyFooterDescr": "Attach a footer to the bottom of the viewport when page content is short.",
"stickyFooterTitle": "Sticky footer",
"strapline": "React components for faster and easier web development. Build your own design system, or start with Material Design.",
"tableOfContents": "Contents",
"thanks": "Thank you!",
"themes": "Premium themes",
"themesButton": "Browse themes",
"themesDescr": "Take your project to the next level with premium themes from our store – all built on MUI.",
"toggleNotifications": "Toggle notifications panel",
"toggleRTL": "Toggle right-to-left/left-to-right",
"toggleTheme": "Toggle light/dark theme",
"traffic": "Traffic",
"usage": "Usage",
"usageButton": "Explore the docs",
"usageDescr": "MUI components work without any additional setup, and don't pollute the global scope.",
"useDarkTheme": "Use dark theme",
"useHighDensity": "Apply higher density via props",
"usingMui": "Are you using MUI?",
"viewGitHub": "View the source on GitHub",
"visit": "Visit the website",
"whosUsing": "Who's using MUI?",
"initialFocusLabel": "A generic container that is programmatically focused to test keyboard navigation of our components.",
"resetFocus": "Reset focus to test keyboard navigation",
"pages": {
"/getting-started": "Getting Started",
"/getting-started/installation": "Installation",
Expand Down

0 comments on commit b6cdf15

Please sign in to comment.