mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-01 16:00:29 +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
|
@ -7,7 +7,7 @@
|
|||
|
||||
import path from 'path';
|
||||
import _ from 'lodash';
|
||||
import {DEFAULT_PLUGIN_ID, I18N_DIR_NAME} from './constants';
|
||||
import {DEFAULT_PLUGIN_ID} from './constants';
|
||||
import {normalizeUrl} from './urlUtils';
|
||||
import type {
|
||||
TranslationFileContent,
|
||||
|
@ -46,24 +46,18 @@ export function updateTranslationFileMessages(
|
|||
* expect everything it needs for translations to be found under this path.
|
||||
*/
|
||||
export function getPluginI18nPath({
|
||||
siteDir,
|
||||
locale,
|
||||
localizationDir,
|
||||
pluginName,
|
||||
pluginId = DEFAULT_PLUGIN_ID,
|
||||
subPaths = [],
|
||||
}: {
|
||||
siteDir: string;
|
||||
locale: string;
|
||||
localizationDir: string;
|
||||
pluginName: string;
|
||||
pluginId?: string | undefined;
|
||||
subPaths?: string[];
|
||||
}): string {
|
||||
return path.join(
|
||||
siteDir,
|
||||
I18N_DIR_NAME,
|
||||
// Namespace first by locale: convenient to work in a single folder for a
|
||||
// translator
|
||||
locale,
|
||||
localizationDir,
|
||||
// Make it convenient to use for single-instance
|
||||
// ie: return "docs", not "docs-default" nor "docs/default"
|
||||
`${pluginName}${pluginId === DEFAULT_PLUGIN_ID ? '' : `-${pluginId}`}`,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue