mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-16 02:27:21 +02:00
fix(content-docs): make category index text translatable (#7233)
This commit is contained in:
parent
996901b53b
commit
10a5ebecec
6 changed files with 121 additions and 104 deletions
|
@ -7,8 +7,8 @@
|
|||
|
||||
import _ from 'lodash';
|
||||
import type {Sidebars} from './sidebars/types';
|
||||
import {createSidebarsUtils} from './sidebars/utils';
|
||||
import type {LoadedVersion} from './types';
|
||||
import {getMainDocId} from './docs';
|
||||
import type {FullVersion} from './types';
|
||||
import type {
|
||||
CategoryGeneratedIndexMetadata,
|
||||
DocMetadata,
|
||||
|
@ -39,11 +39,10 @@ function toGlobalDataGeneratedIndex(
|
|||
|
||||
function toGlobalSidebars(
|
||||
sidebars: Sidebars,
|
||||
version: LoadedVersion,
|
||||
version: FullVersion,
|
||||
): {[sidebarId: string]: GlobalSidebar} {
|
||||
const {getFirstLink} = createSidebarsUtils(sidebars);
|
||||
return _.mapValues(sidebars, (sidebar, sidebarId) => {
|
||||
const firstLink = getFirstLink(sidebarId);
|
||||
const firstLink = version.sidebarsUtils.getFirstLink(sidebarId);
|
||||
if (!firstLink) {
|
||||
return {};
|
||||
}
|
||||
|
@ -62,13 +61,13 @@ function toGlobalSidebars(
|
|||
});
|
||||
}
|
||||
|
||||
export function toGlobalDataVersion(version: LoadedVersion): GlobalVersion {
|
||||
export function toGlobalDataVersion(version: FullVersion): GlobalVersion {
|
||||
return {
|
||||
name: version.versionName,
|
||||
label: version.label,
|
||||
isLast: version.isLast,
|
||||
path: version.path,
|
||||
mainDocId: version.mainDocId,
|
||||
mainDocId: getMainDocId(version),
|
||||
docs: version.docs
|
||||
.map(toGlobalDataDoc)
|
||||
.concat(version.categoryGeneratedIndices.map(toGlobalDataGeneratedIndex)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue