Skip to content

[Bug]: plugin-api-docgen only works for en and zh languages #1872

Open
@SevereCloud

Description

Version

System:
    OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 7800X3D 8-Core Processor
    Memory: 11.40 GB / 15.18 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  npmPackages:
    @rspress/plugin-api-docgen: ^1.42.0 => 1.42.0 
    rspress: ^1.40.2 => 1.42.0

Details

The plugin generates documentation only for English and Chinese languages.

const languages = (
config.themeConfig?.locales?.map(locale => locale.lang) ||
config.locales?.map(locale => locale.lang) || [config.lang]
).filter(lang => lang === 'zh' || lang === 'en') as SupportLanguages[];

if (languages.length > 0) {
languages.forEach(language => {
apiDocMap[`${key}-${language}`] = generateTable(
componentDoc,
language,
);
});
} else {
apiDocMap[key] = generateTable(componentDoc, 'en');
}

const apiDoc =
apiDocMap?.[moduleName] || apiDocMap?.[`${moduleName}-${lang}`];

Other languages ​​will be ignored

The plugin documentation does not contain any language support restrictions.

Reproduce link

https://codesandbox.io/p/devbox/prod-bush-yr4yvc?workspaceId=ws_Ei2fajyF27vYb9X5Z2t9Gy

Reproduce Steps

  1. Open Russian version
  2. Open English version

Expected result:

The plugin works with any languages(English as a fallback)

Actual result:

The plugin works only with English language

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions