Skip to content

Commit 28122d3

Browse files
committed
Translatable Access description in consent documents
1 parent 40eb8eb commit 28122d3

3 files changed

Lines changed: 32 additions & 3 deletions

File tree

src/export/ExportStringDefinitions.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface ExportStringDefinition {
1313
/** Context to help translators understand what this string is for */
1414
context: string;
1515
/** Category for grouping in the UI */
16-
category: "bundle-title" | "bundle-description";
16+
category: "bundle-title" | "bundle-description" | "bundle-access-description";
1717
}
1818

1919
/**
@@ -54,6 +54,11 @@ export const EXPORT_STRING_DEFINITIONS: ExportStringDefinition[] = [
5454
"This bundle contains media demonstrating informed consent for sessions in this collection.",
5555
context: "Description for the Consent Documents bundle.",
5656
category: "bundle-description"
57+
},
58+
{
59+
english: "Consent documents",
60+
context: "Access description used on each consent file in the Consent Documents bundle.",
61+
category: "bundle-access-description"
5762
}
5863
];
5964

@@ -88,6 +93,7 @@ export const ExportStrings = {
8893
ConsentDocuments: {
8994
title: "Documentation of consent for the contributors to this collection",
9095
description:
91-
"This bundle contains media demonstrating informed consent for sessions in this collection."
96+
"This bundle contains media demonstrating informed consent for sessions in this collection.",
97+
accessDescription: "Consent documents"
9298
}
9399
} as const;

src/export/ImdiBundler.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,13 @@ export default class ImdiBundler {
507507
"ELAR"
508508
) {
509509
dummySession.properties.setText("access", "S");
510-
dummySession.properties.setText("accessDescription", "Consent documents");
510+
dummySession.properties.setText(
511+
"accessDescription",
512+
buildMultilingualExportString(
513+
ExportStrings.ConsentDocuments.accessDescription,
514+
project
515+
)
516+
);
511517
}
512518

513519
const originalConsentFiles = ImdiBundler.addDummyFileForConsentActors(

src/export/consentImdi.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ describe("Consent in OPEX+Files export", () => {
6666
it("If ELAR, it should have an Access of 'S'", () => {
6767
expect("//MediaFile/Access/Availability").toMatch("S");
6868
expect("//MediaFile/Access/Description").toMatch("Consent documents");
69+
expect(
70+
"//MediaFile/Access/Description[@LanguageId='ISO639-3:spa']"
71+
).toMatch("Documentos de consentimiento");
6972
});
7073

7174
// per Notion #241
@@ -118,6 +121,20 @@ async function doExport(
118121

119122
const project = Project.fromDirectory(projectDir);
120123

124+
// Set up multiple metadata languages so multilingual fields are emitted
125+
project.properties.setText("metadataLanguages", "en:English;es:Spanish");
126+
127+
// Provide a project translation for the access description used by the consent bundle
128+
project.vocabularyTranslations?.ensureExportStringEntry(
129+
"Consent documents",
130+
["en", "es"]
131+
);
132+
project.vocabularyTranslations?.updateExportStringTranslation(
133+
"Consent documents",
134+
"es",
135+
"Documentos de consentimiento"
136+
);
137+
121138
// NB: this is to test the access protocol used for consent bundles,
122139
// which has a hard-coded knowledge of the access protocol used for
123140
// ELAR currently. If/when we add knowledge of what other archives

0 commit comments

Comments
 (0)