Skip to content

Commit 6d2163f

Browse files
committed
localize source prefix
1 parent aeabbea commit 6d2163f

20 files changed

+29
-4
lines changed

src/config/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ export const kTocTitleDocument = "toc-title-document";
165165
export const kTocTitleWebsite = "toc-title-website";
166166
export const kRelatedFormatsTitle = "related-formats-title";
167167
export const kRelatedNotebooksTitle = "related-notebooks-title";
168+
export const kSourceNotebookPrefix = "source-notebooks-prefix";
168169
export const kCalloutTipCaption = "callout-tip-caption";
169170
export const kCalloutNoteCaption = "callout-note-caption";
170171
export const kCalloutWarningCaption = "callout-warning-caption";
@@ -262,6 +263,7 @@ export const kLanguageDefaultsKeys = [
262263
kTocTitleWebsite,
263264
kRelatedFormatsTitle,
264265
kRelatedNotebooksTitle,
266+
kSourceNotebookPrefix,
265267
kCalloutTipCaption,
266268
kCalloutNoteCaption,
267269
kCalloutWarningCaption,

src/config/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ import {
165165
kShiftHeadingLevelBy,
166166
kShortcodes,
167167
kSlideLevel,
168+
kSourceNotebookPrefix,
168169
kStandalone,
169170
kSyntaxDefinitions,
170171
kTableOfContents,
@@ -501,6 +502,7 @@ export interface FormatLanguage {
501502
[kTocTitleDocument]?: string;
502503
[kTocTitleWebsite]?: string;
503504
[kRelatedFormatsTitle]?: string;
505+
[kSourceNotebookPrefix]?: string;
504506
[kRelatedNotebooksTitle]?: string;
505507
[kCalloutTipCaption]?: string;
506508
[kCalloutNoteCaption]?: string;

src/format/html/format-html-bootstrap.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
kRelatedFormatsTitle,
2424
kRelatedNotebooksTitle,
2525
kSectionDivs,
26+
kSourceNotebookPrefix,
2627
kTocDepth,
2728
kTocLocation,
2829
} from "../../config/constants.ts";
@@ -543,8 +544,14 @@ function processNotebookEmbeds(
543544
nbLinkEl.setAttribute("id", `${id}`);
544545
nbLinkEl.setAttribute("href", nbPath.path);
545546
nbLinkEl.setAttribute("download", nbPath.filename);
546-
nbLinkEl.appendChild(doc.createTextNode(`Source: ${nbPath.title}`));
547+
nbLinkEl.appendChild(
548+
doc.createTextNode(
549+
`${format.language[kSourceNotebookPrefix]}: ${nbPath.title}`,
550+
),
551+
);
547552

553+
// If there is a figure caption, place the source after that
554+
// otherwise just place it at the bottom of the notebook div
548555
const nbParentEl = nbDivEl.parentElement;
549556
if (nbParentEl?.tagName.toLocaleLowerCase() === "figure") {
550557
const figCapEl = nbDivEl.parentElement?.querySelector("figcaption");
@@ -556,9 +563,6 @@ function processNotebookEmbeds(
556563
} else {
557564
nbDivEl.appendChild(nbLinkEl);
558565
}
559-
560-
// Try to place it after the figure caption, if possible
561-
// For tables, place after the table caption if they are on the bottom
562566
}
563567
});
564568

src/resources/language/_language-cs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ toc-title-website: "Na této stránce"
33

44
related-formats-title: "Jiné formáty"
55
related-notebooks-title: "Notebooks"
6+
source-notebooks-prefix: "Zdroj"
67

78
section-title-abstract: "Abstrakt"
89
section-title-appendices: "Přílohy"

src/resources/language/_language-da.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ toc-title-website: "På denne side"
33

44
related-formats-title: "Andre formater"
55
related-notebooks-title: "Notebooks"
6+
source-notebooks-prefix: "Kilde"
67

78
section-title-abstract: "Resume"
89
section-title-appendices: "Bilag"

src/resources/language/_language-de.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ toc-title-website: "Auf dieser Seite"
33

44
related-formats-title: "Andere Formate"
55
related-notebooks-title: "Notebooks"
6+
source-notebooks-prefix: "Quelle"
67

78
section-title-abstract: "Zusammenfassung"
89
section-title-appendices: "Anhang"

src/resources/language/_language-es.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ toc-title-website: "En esta página"
33

44
related-formats-title: "Otros formatos"
55
related-notebooks-title: "Notebooks"
6+
source-notebooks-prefix: "Fuente"
67

78
section-title-abstract: "Resumen"
89
section-title-appendices: "Apéndices"

src/resources/language/_language-fi.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ toc-title-website: "Tällä sivulla"
33

44
related-formats-title: "Muut muodot"
55
related-notebooks-title: "Notebooks"
6+
source-notebooks-prefix: "Lähde"
67

78
section-title-abstract: "Tiivistelmä"
89
section-title-appendices: "Liitteet"

src/resources/language/_language-fr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ toc-title-website: "Sur cette page"
33

44
related-formats-title: "Autres formats"
55
related-notebooks-title: "Notebooks"
6+
source-notebooks-prefix: "La source"
67

78
section-title-abstract: "Résumé"
89
section-title-appendices: "Annexes"

src/resources/language/_language-it.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ toc-title-website: "In questa pagina"
33

44
related-formats-title: "Altri Formati"
55
related-notebooks-title: "Notebooks"
6+
source-notebooks-prefix: "Fonte"
67

78
section-title-abstract: "Sommario"
89
section-title-appendices: "Appendici"

0 commit comments

Comments
 (0)