From 9eb6ff203486d9ef8c10d237afb105ce3e79211b Mon Sep 17 00:00:00 2001 From: Frank Li Date: Fri, 4 Aug 2017 10:44:54 -0700 Subject: [PATCH] Update write-translations.js to find versioned sidebar category names --- lib/write-translations.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/write-translations.js b/lib/write-translations.js index 24c46f1514..d8a0f4bc13 100644 --- a/lib/write-translations.js +++ b/lib/write-translations.js @@ -74,6 +74,20 @@ function execute() { }); }); + files = glob.sync(CWD + "/versioned_sidebars/*"); + files.forEach(file => { + if (!file.endsWith("-sidebar.json")) { + return; + } + sidebarContent = JSON.parse(fs.readFileSync(file, "utf8")); + Object.keys(sidebarContent).forEach(sb => { + const categories = sidebarContent[sb]; + Object.keys(categories).forEach(category => { + translations["localized-strings"][category] = category; + }); + }); + }); + /* go through pages to look for text inside translate tags */ files = glob.sync(CWD + "/pages/en/**"); files.forEach(file => {