mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-31 01:47:17 +02:00
feat(v2): infer default i18n locale config from locale code (#4449)
* improve locale default config * remove localeConfigs from i18n tutorial * better i18n types, tests and Intl.DisplayNames integration
This commit is contained in:
parent
5e73c72f26
commit
806fdbaf27
10 changed files with 189 additions and 110 deletions
|
@ -46,26 +46,6 @@ const isVersioningDisabled = !!process.env.DISABLE_VERSIONING;
|
|||
// https://docusaurus-i18n-staging.netlify.app/
|
||||
const isI18nStaging = process.env.I18N_STAGING === 'true';
|
||||
|
||||
const LocaleConfigs = isI18nStaging
|
||||
? // Staging locales (https://docusaurus-i18n-staging.netlify.app/)
|
||||
{
|
||||
en: {
|
||||
label: 'English',
|
||||
},
|
||||
'zh-CN': {
|
||||
label: '简体中文',
|
||||
},
|
||||
}
|
||||
: // Production locales
|
||||
{
|
||||
en: {
|
||||
label: 'English',
|
||||
},
|
||||
fr: {
|
||||
label: 'Français',
|
||||
},
|
||||
};
|
||||
|
||||
/** @type {import('@docusaurus/types').DocusaurusConfig} */
|
||||
(module.exports = {
|
||||
title: 'Docusaurus',
|
||||
|
@ -77,8 +57,11 @@ const LocaleConfigs = isI18nStaging
|
|||
url: 'https://v2.docusaurus.io',
|
||||
i18n: {
|
||||
defaultLocale: 'en',
|
||||
locales: Object.keys(LocaleConfigs),
|
||||
localeConfigs: LocaleConfigs,
|
||||
locales: isI18nStaging
|
||||
? // Staging locales (https://docusaurus-i18n-staging.netlify.app/)
|
||||
['en', 'zh-CN']
|
||||
: // Production locales
|
||||
['en', 'fr'],
|
||||
},
|
||||
onBrokenLinks: 'throw',
|
||||
onBrokenMarkdownLinks: 'warn',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue