mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-21 21:16:59 +02:00
feat(core): allow customizing the i18n directory path (#7386)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
c07a514730
commit
abe5450526
26 changed files with 147 additions and 166 deletions
|
@ -19,6 +19,7 @@ const DefaultI18N: I18n = {
|
|||
currentLocale: 'en',
|
||||
locales: ['en'],
|
||||
defaultLocale: 'en',
|
||||
path: '1i8n',
|
||||
localeConfigs: {
|
||||
en: {
|
||||
label: 'English',
|
||||
|
|
|
@ -47,6 +47,7 @@ function getI18n(locale: string): I18n {
|
|||
currentLocale: locale,
|
||||
locales: [locale],
|
||||
defaultLocale: locale,
|
||||
path: 'i18n',
|
||||
localeConfigs: {
|
||||
[locale]: {
|
||||
calendar: 'gregory',
|
||||
|
@ -70,6 +71,7 @@ const getPlugin = async (
|
|||
i18n: I18n = DefaultI18N,
|
||||
) => {
|
||||
const generatedFilesDir: string = path.resolve(siteDir, '.docusaurus');
|
||||
const localizationDir = path.join(siteDir, i18n.path, i18n.currentLocale);
|
||||
const siteConfig = {
|
||||
title: 'Hello',
|
||||
baseUrl: '/',
|
||||
|
@ -81,6 +83,7 @@ const getPlugin = async (
|
|||
siteConfig,
|
||||
generatedFilesDir,
|
||||
i18n,
|
||||
localizationDir,
|
||||
} as LoadContext,
|
||||
validateOptions({
|
||||
validate: normalizePluginOptions as Validate<
|
||||
|
|
|
@ -59,6 +59,7 @@ export default async function pluginContentBlog(
|
|||
siteDir,
|
||||
siteConfig,
|
||||
generatedFilesDir,
|
||||
localizationDir,
|
||||
i18n: {currentLocale},
|
||||
} = context;
|
||||
const {onBrokenMarkdownLinks, baseUrl} = siteConfig;
|
||||
|
@ -66,8 +67,7 @@ export default async function pluginContentBlog(
|
|||
const contentPaths: BlogContentPaths = {
|
||||
contentPath: path.resolve(siteDir, options.path),
|
||||
contentPathLocalized: getPluginI18nPath({
|
||||
siteDir,
|
||||
locale: currentLocale,
|
||||
localizationDir,
|
||||
pluginName: 'docusaurus-plugin-content-blog',
|
||||
pluginId: options.id,
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue