blob: 7261fcd2e5b2bcf705de737fee8cb7afaa615e42 [file]
function sourceForLocalized(file) {
const match = file.match(/^i18n\/[^/]+\/docusaurus-plugin-content-docs(-[^/]+)?\/(current|version-([^/]+))\/(.*)$/);
if (!match) return null;
const plugin = match[1] || '', version = match[3], relative = match[4];
const roots = {'':'docs', '-community':'community', '-releases':'releasenotes', '-course':'course',
'-course-ui':'src', '-community-report':'src/pages/community-report/_reports',
'-community-report-ui':'src'};
if (!roots[plugin]) return null;
if (version) return plugin === '' ? `versioned_docs/version-${version}/${relative}` : null;
return `${roots[plugin]}/${relative}`;
}
module.exports = {sourceForLocalized};