Skip to content

Commit 79c8bb2

Browse files
authored
fix: en docs content fallback (#281)
1 parent 709f5c0 commit 79c8bb2

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

docusaurus.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66

77
import { themes } from 'prism-react-renderer';
88

9+
const defaultExclude = ['**/_*.{js,jsx,ts,tsx,md,mdx}', '**/_*/**', '**/*.test.{js,jsx,ts,tsx}', '**/__tests__/**'];
10+
11+
// some docs are not translated, so we need to exclude them in en
12+
const excludeInEn = ['**/viz/8-extensions/**', '**/viz/9-message-schemas/**'];
13+
914
/** @type {import('@docusaurus/types').Config} */
1015
const config = {
1116
title: 'coScene',
@@ -60,6 +65,8 @@ const config = {
6065
// editUrl: 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
6166
showLastUpdateAuthor: true,
6267
showLastUpdateTime: true,
68+
exclude:
69+
process.env.DOCUSAURUS_CURRENT_LOCALE === 'en' ? [...defaultExclude, ...excludeInEn] : defaultExclude,
6370
},
6471
blog: false,
6572
// blog: {

i18n/en/code.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,6 @@
503503
"home.catalogue.frame-rate-optimization": {
504504
"message": "Frame Rate Optimization"
505505
},
506-
"home.catalogue.extensions": {
507-
"message": "Extensions"
508-
},
509506
"home.catalogue.options": {
510507
"message": "Visualization Options"
511508
},
@@ -602,4 +599,4 @@
602599
"home.catalogue.apt-source-install": {
603600
"message": "Installing coScene Software via APT"
604601
}
605-
}
602+
}

src/components/homeCatalogue/catalogue.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@ export const CATALOGUE = [
5252
docLink: '/viz/frame-rate-optimization',
5353
title: translate({ id: 'home.catalogue.frame-rate-optimization', message: '帧率优化选项' }),
5454
},
55-
{ docLink: '/category/extensions', title: translate({ id: 'home.catalogue.extensions', message: '插件' }) },
56-
{
57-
docLink: '/viz/message-schemas',
58-
title: translate({ id: 'home.catalogue.message-schemas', message: '消息架构' }),
59-
},
55+
...(typeof process !== 'undefined' && process.env.DOCUSAURUS_CURRENT_LOCALE === 'zh' ? [
56+
{ docLink: '/category/extensions', title: translate({ id: 'home.catalogue.extensions', message: '插件' }) },
57+
{
58+
docLink: '/viz/message-schemas',
59+
title: translate({ id: 'home.catalogue.message-schemas', message: '消息架构' }),
60+
},
61+
] : []),
6062
],
6163
},
6264
{

0 commit comments

Comments
 (0)