Skip to content

Commit 1b3c9be

Browse files
authored
chore(v2): setup for i18n staging deployment (#4214)
1 parent 7f6c4be commit 1b3c9be

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

website/docusaurus.config.js

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,33 @@ const isBootstrapPreset = process.env.DOCUSAURUS_PRESET === 'bootstrap';
4141

4242
const isVersioningDisabled = !!process.env.DISABLE_VERSIONING;
4343

44+
// Special deployment for staging locales until they get enough translations
45+
// https://app.netlify.com/sites/docusaurus-i18n-staging
46+
// https://docusaurus-i18n-staging.netlify.app/
47+
const isI18nStaging = process.env.I18N_STAGING === 'true';
48+
49+
const LocaleConfigs = isI18nStaging
50+
? // Staging locales (https://docusaurus-i18n-staging.netlify.app/)
51+
{
52+
en: {
53+
label: 'English',
54+
},
55+
'zh-CN': {
56+
label: '简体中文',
57+
},
58+
}
59+
: // Production locales
60+
{
61+
en: {
62+
label: 'English',
63+
},
64+
fr: {
65+
label: 'Français',
66+
},
67+
};
68+
4469
/** @type {import('@docusaurus/types').DocusaurusConfig} */
45-
module.exports = {
70+
(module.exports = {
4671
title: 'Docusaurus',
4772
tagline: 'Build optimized websites quickly, focus on your content',
4873
organizationName: 'facebook',
@@ -52,15 +77,8 @@ module.exports = {
5277
url: 'https://v2.docusaurus.io',
5378
i18n: {
5479
defaultLocale: 'en',
55-
locales: ['en', 'fr'],
56-
localeConfigs: {
57-
en: {
58-
label: 'English',
59-
},
60-
fr: {
61-
label: 'Français',
62-
},
63-
},
80+
locales: Object.keys(LocaleConfigs),
81+
localeConfigs: LocaleConfigs,
6482
},
6583
onBrokenLinks: 'throw',
6684
onBrokenMarkdownLinks: 'warn',
@@ -441,4 +459,4 @@ module.exports = {
441459
copyright: `Copyright © ${new Date().getFullYear()} Facebook, Inc. Built with Docusaurus.`,
442460
},
443461
},
444-
};
462+
});

0 commit comments

Comments
 (0)