diff --git a/README_KB.md b/README_KB.md
index ba22112..b24035a 100644
--- a/README_KB.md
+++ b/README_KB.md
@@ -7,6 +7,9 @@ Source GitHub repository (master branch):
https://github.com/daisy/kb
Git submodule revision:
-6df0f67cbd06706809366b088732c93c06212a2a
-https://github.com/daisy/kb/commits/6df0f67cbd06706809366b088732c93c06212a2a
-https://github.com/daisy/kb/compare/6df0f67cbd06706809366b088732c93c06212a2a...main
+6b5d5d42fd7608f8a5387b51b0c0dea46d1fc1ea
+https://github.com/daisy/kb/commits/6b5d5d42fd7608f8a5387b51b0c0dea46d1fc1ea
+https://github.com/daisy/kb/compare/6b5d5d42fd7608f8a5387b51b0c0dea46d1fc1ea...main
+
+PREVIOUS WAS:
+https://github.com/daisy/kb/compare/6df0f67cbd06706809366b088732c93c06212a2a...6b5d5d42fd7608f8a5387b51b0c0dea46d1fc1ea
diff --git a/src/main/kb.js b/src/main/kb.js
index ff3af9d..7f18f16 100644
--- a/src/main/kb.js
+++ b/src/main/kb.js
@@ -7,7 +7,7 @@ const { BrowserWindow, webContents } = require('electron');
import { app, shell, session, ipcMain, Menu } from 'electron';
import { localizer } from './../shared/l10n/localize';
-const { localize } = localizer;
+const { localize, getCurrentLanguage } = localizer;
import * as AboutBoxHelper from './about';
@@ -471,9 +471,13 @@ export function startKnowledgeBaseServer(kbRootPath) {
// fileSystemPath = pn;
// if (LOG_DEBUG) console.log(`${KB_LOG_PREFIX} --filepath to read (corrected): ${fileSystemPath}`);
// if (!fs.existsSync(fileSystemPath)) {
- if (LOG_DEBUG) console.log(`${KB_LOG_PREFIX} --FILE DOES NOT EXIST!! ${kbRootPath} + ${req.url} => ${fileSystemPath}`);
- const html = `
${pn} (404 missing file?)
`;
- const buff = Buffer.from(html);
+ if (LOG_DEBUG) console.log(`${KB_LOG_PREFIX} --FILE DOES NOT EXIST!! ${kbRootPath} + ${req.url} => ${fileSystemPath} (${localize("kbgoonline")})`);
+ const html = ` !! ${pn}
+
+ `;
+ const buff = Buffer.from(html, "utf-8");
headers["Content-Length"] = buff.length.toString();
headers["Content-Type"] = "text/html";
callback({
@@ -1008,7 +1012,7 @@ export class KnowledgeBase {
return { action: 'deny' };
}
- if (obj.url.replace(/\/\/+/g, "/").indexOf("publishing/docs/search") >= 0) {
+ if (obj.url.replace(/\/\/+/g, "/").indexOf("publishing/docs/search") >= 0 || obj.url.replace(/\/\/+/g, "/").indexOf("publishing/ja/search") >= 0) {
shell.openExternal(obj.url.replace(rootUrl, "http://kb.daisy.org"));
// preventDefault()
@@ -1028,7 +1032,7 @@ export class KnowledgeBase {
event.preventDefault();
shell.openExternal(url);
}
- if (url.replace(/\/\/+/g, "/").indexOf("publishing/docs/search") >= 0) {
+ if (url.replace(/\/\/+/g, "/").indexOf("publishing/docs/search") >= 0 || url.replace(/\/\/+/g, "/").indexOf("publishing/ja/search") >= 0) {
event.preventDefault();
shell.openExternal(url.replace(rootUrl, "http://kb.daisy.org"));
}
@@ -1038,7 +1042,7 @@ export class KnowledgeBase {
if (this.urlPath) {
this.win.loadURL(`${rootUrl}${this.urlPath}`);
} else {
- this.win.loadURL(`${rootUrl}/publishing/docs/index.html`);
+ this.win.loadURL(`${rootUrl}/publishing/${getCurrentLanguage() === "ja" ? "ja" : "docs"}/index.html`);
}
this.win.on('closed', function () {
diff --git a/src/main/menu.js b/src/main/menu.js
index 2873d3e..50acaf9 100644
--- a/src/main/menu.js
+++ b/src/main/menu.js
@@ -86,7 +86,7 @@ export default class MenuBuilder {
runAceInRendererProcess(filepath) {
this.mainWindow.webContents.send('RUN_ACE', filepath);
}
-
+
buildTemplate() {
const defaultTemplate = {
@@ -103,7 +103,7 @@ export default class MenuBuilder {
await showEpubFileOrFolderBrowseDialog((filepath) => {
this.store.dispatch(closeReport());
this.store.dispatch(resetInitialReportView());
-
+
this.runAceInRendererProcess(filepath);
});
} else {
@@ -346,7 +346,7 @@ export default class MenuBuilder {
{
label: localize('menu.knowledgeBaseOnline'),
click: () => {
- shell.openExternal('http://kb.daisy.org/publishing/docs/index.html');
+ shell.openExternal(`http://kb.daisy.org/publishing/${getCurrentLanguage() === "ja" ? "ja" : "docs"}/index.html`);
}
}
]
diff --git a/src/renderer/components/MetaDataEditorModal.js b/src/renderer/components/MetaDataEditorModal.js
index 3b3668a..321f38b 100644
--- a/src/renderer/components/MetaDataEditorModal.js
+++ b/src/renderer/components/MetaDataEditorModal.js
@@ -40,7 +40,7 @@ import {openFile} from './../../shared/actions/app';
import Select from '@material-ui/core/Select';
import MenuItem from '@material-ui/core/MenuItem';
import { localizer } from './../../shared/l10n/localize';
-const { localize } = localizer; // setCurrentLanguage, getCurrentLanguage,
+const { localize, getCurrentLanguage } = localizer; // setCurrentLanguage
import classNames from 'classnames';
import { ipcRenderer } from 'electron';
import {
@@ -191,12 +191,12 @@ class MetaDataEditorModal extends React.Component {
packageOpfXPathSelect = undefined;
onKBSchemaOrg = () => {
- const url = `${KB_BASE}docs/metadata/schema.org/index.html`;
+ const url = `${KB_BASE}${getCurrentLanguage() === "ja" ? "ja" : "docs"}/metadata/schema.org/index.html`;
ipcRenderer.send('KB_URL', url);
// shell.openExternal(url);
}
onKBEvaluation = () => {
- const url = `${KB_BASE}docs/metadata/evaluation.html`;
+ const url = `${KB_BASE}${getCurrentLanguage() === "ja" ? "ja" : "docs"}/metadata/evaluation.html`;
ipcRenderer.send('KB_URL', url);
// shell.openExternal(url);
}
diff --git a/src/renderer/components/ReportSections/Metadata.js b/src/renderer/components/ReportSections/Metadata.js
index 8d999cd..00924eb 100644
--- a/src/renderer/components/ReportSections/Metadata.js
+++ b/src/renderer/components/ReportSections/Metadata.js
@@ -12,7 +12,7 @@ import {selectTab} from './../../../shared/actions/reportView';
import {zipEpub} from './../../../shared/actions/app';
import { localizer } from './../../../shared/l10n/localize';
-const { localize } = localizer;
+const { localize, getCurrentLanguage } = localizer;
import a11yMetadata from '@daisy/ace-core/lib/core/a11y-metadata';
@@ -80,12 +80,12 @@ class Metadata extends React.Component {
};
onKBSchemaOrg = () => {
- const url = `${KB_BASE}docs/metadata/schema.org/index.html`;
+ const url = `${KB_BASE}${getCurrentLanguage() === "ja" ? "ja" : "docs"}/metadata/schema.org/index.html`;
ipcRenderer.send('KB_URL', url);
// shell.openExternal(url);
}
onKBEvaluation = () => {
- const url = `${KB_BASE}docs/metadata/evaluation.html`;
+ const url = `${KB_BASE}${getCurrentLanguage() === "ja" ? "ja" : "docs"}/metadata/evaluation.html`;
ipcRenderer.send('KB_URL', url);
// shell.openExternal(url);
}
@@ -229,7 +229,7 @@ class Metadata extends React.Component {
suffix = ` (${A11Y_META[data].required ? localize("report.summarySection.serious") : localize("report.summarySection.moderate")})`
}
}
-
+
return ({data}{suffix});
})}
{a11ymetadata.empty && a11ymetadata.empty.sort().map((data, idx) => {
@@ -239,7 +239,7 @@ class Metadata extends React.Component {
suffix = ` (${A11Y_META[data].required ? localize("report.summarySection.serious") : localize("report.summarySection.moderate")})`
}
}
-
+
return ({data}{suffix});
})}
diff --git a/src/renderer/components/ReportSections/Violations.js b/src/renderer/components/ReportSections/Violations.js
index 566d960..20373cc 100644
--- a/src/renderer/components/ReportSections/Violations.js
+++ b/src/renderer/components/ReportSections/Violations.js
@@ -5,7 +5,7 @@ import TableCell from '@material-ui/core/TableCell';
const {ipcRenderer} = require('electron');
import { localizer } from './../../../shared/l10n/localize';
-const { localize } = localizer;
+const { localize, getCurrentLanguage } = localizer;
// the violations page of the report
export default class Violations extends React.Component {
@@ -115,8 +115,8 @@ export default class Violations extends React.Component {
href="#"
tabIndex={0}
className="external-link"
- onKeyPress={(e) => { if (e.key === "Enter") { this.onExternalLinkClick(row.details.kburl); }}}
- onClick={() => this.onExternalLinkClick(row.details.kburl)}
+ onKeyPress={(e) => { if (e.key === "Enter") { this.onExternalLinkClick(getCurrentLanguage() === "ja" ? row.details.kburl.replace(/\/docs\//, "/ja/") : row.details.kburl); }}}
+ onClick={() => this.onExternalLinkClick(getCurrentLanguage() === "ja" ? row.details.kburl.replace(/\/docs\//, "/ja/") : row.details.kburl)}
>{localize("report.violationsSection.learnAbout")} {row.details.kbtitle}
}