Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
panaC committed Oct 27, 2022
1 parent ce0a121 commit 4cdd2d1
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import * as React from "react";
import { TPublication } from "readium-desktop/common/type/publication.type";
import { convertMultiLangStringToString } from "readium-desktop/renderer/common/language-string";
import { TranslatorProps, withTranslator } from "../../hoc/translator";
import isURL from "validator/lib/isURL";
// Logger
const debug = debug_("readium-desktop:renderer:publicationA11y");
debug("_");
Expand Down Expand Up @@ -197,17 +198,32 @@ export class PublicationInfoA11y extends React.Component<IProps, IState> {
const AccessibilityConformsTo = (() => {

if (!(Array.isArray(a11y_conformsTo) && a11y_conformsTo[0])) return undefined;
return <a href={a11y_conformsTo[0]}>{a11y_conformsTo[0]}</a>;
const value = a11y_conformsTo[0];
if (isURL(value)) {
const label = value === "http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-a"
? "EPUB Accessibility 1.0 - WCAG 2.0 Level A"
: value === "http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aa"
? "EPUB Accessibility 1.0 - WCAG 2.0 Level AA"
: value === "http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aaa"
? "EPUB Accessibility 1.0 - WCAG 2.0 Level AAA"
: value;
return <li>{__("publication.accessibility.conformsTo")} {label}</li>;
}
return <li>{__("publication.accessibility.conformsTo")} {value}</li>;
})();

const AccessibilityConformanceReport = (() => {

if (!(Array.isArray(a11y_certifierReport) && a11y_certifierReport[0])) return undefined;
return <a href={a11y_certifierReport[0]}>{a11y_certifierReport[0]}</a>;
const value = a11y_certifierReport[0];
if (isURL(value)) {
return <li>{__("publication.accessibility.certifierReport")} <a href={value} aria-label={__("publication.accessibility.certifierReport")}>{__("publication.accessibility.link")}</a></li>;
}
return <li>{__("publication.accessibility.certifierReport")} {value}</li>;
})();

return (AccessModeSufficient || AccessibilityHazard) ? <>
<ul style={{ listStyleType: "none" }}>
<ul>
{AccessModeSufficient ? AccessModeSufficient : <></>}
{AccessibilityFeatureIsprintPageNumber ? AccessibilityFeatureIsprintPageNumber : <></>}
{AccessibilityFeatureIsDisplayTransformability ? AccessibilityFeatureIsDisplayTransformability : <></>}
Expand All @@ -218,10 +234,10 @@ export class PublicationInfoA11y extends React.Component<IProps, IState> {

<details>
<summary>{__("publication.accessibility.moreInformation")}</summary>
<ul style={{ listStyleType: "none" }}>
<ul>
{AccessibilityFeature ? AccessibilityFeature : <></>}
{AccessibilityConformsTo ? <li>{AccessibilityConformsTo}</li> : <></>}
{AccessibilityConformanceReport ? <li>{AccessibilityConformanceReport}</li> : <></>}
{AccessibilityConformsTo ? AccessibilityConformsTo : <></>}
{AccessibilityConformanceReport ? AccessibilityConformanceReport : <></>}
{AccessibiltySummary}
</ul>
</details>
Expand Down
3 changes: 3 additions & 0 deletions src/resources/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@
"sound": "Sound",
"unknown": "Unknown"
},
"conformsTo": "Conforms to:",
"certifierReport": "Certifier report:",
"link": "Link to the certifier report",
"moreInformation": "More information",
"name": "Accessibility",
"noA11y": "No accessibility information available"
Expand Down
3 changes: 3 additions & 0 deletions src/resources/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@
"sound": "Son",
"unknown": "Inconnu"
},
"conformsTo": "Conforme à :",
"certifierReport": "Certificat :",
"link": "Lien vers le certificat",
"moreInformation": "Plus d'information",
"name": "Accessibilité",
"noA11y": "Aucune information d'accessibilité disponible"
Expand Down
9 changes: 9 additions & 0 deletions src/typings/en.translation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,9 @@ declare namespace typed_i18n {
readonly "sound": string,
readonly "unknown": string
},
readonly "conformsTo": string,
readonly "certifierReport": string,
readonly "link": string,
readonly "moreInformation": string,
readonly "name": string,
readonly "noA11y": string
Expand Down Expand Up @@ -533,6 +536,9 @@ declare namespace typed_i18n {
readonly "sound": string,
readonly "unknown": string
},
readonly "conformsTo": string,
readonly "certifierReport": string,
readonly "link": string,
readonly "moreInformation": string,
readonly "name": string,
readonly "noA11y": string
Expand Down Expand Up @@ -579,6 +585,9 @@ declare namespace typed_i18n {
(_: "publication.accessibility.accessibilityHazard.simulation", __?: {}): string;
(_: "publication.accessibility.accessibilityHazard.sound", __?: {}): string;
(_: "publication.accessibility.accessibilityHazard.unknown", __?: {}): string;
(_: "publication.accessibility.conformsTo", __?: {}): string;
(_: "publication.accessibility.certifierReport", __?: {}): string;
(_: "publication.accessibility.link", __?: {}): string;
(_: "publication.accessibility.moreInformation", __?: {}): string;
(_: "publication.accessibility.name", __?: {}): string;
(_: "publication.accessibility.noA11y", __?: {}): string;
Expand Down

0 comments on commit 4cdd2d1

Please sign in to comment.