Skip to content

Commit ad86915

Browse files
authored
Merge pull request #429 from 1EdTech/feature/localization
Feature/localization
2 parents b339e06 + f0bd03a commit ad86915

36 files changed

Lines changed: 1077 additions & 275 deletions
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
Model test01 2022-03-24 v0p1 "s:Draft" "t:Test Model 01" "Test model 01" "l:en-US"
2+
3+
Package DataClasses DataModel
4+
5+
Class Thing Unordered false []
6+
Property id UUID 1
7+
Property startDate DateZ 1
8+
Property endDate DateZ 0..1
9+
10+
Class Thang Unordered false []
11+
Property id UUID 1
12+
Property thingRef UUIDRef 1
13+
Property size Integer 0..1
14+
15+
Package PrimitiveTypes DataModel
16+
//some includes from the common data model
17+
Includes [String, Date, NormalizedString, Integer]
18+
19+
Package DerivedTypes DataModel
20+
//some includes from the common data model
21+
Includes [DateZ, UUID, UUIDRef, Identifier, Reference]
22+
23+
24+
Package BaseService ServiceModel REST /ims/test/v0p1
25+
26+
Interface Things "t:The Thing Endpoints" "n:note1" "n:note2"
27+
28+
Operation getThingById GET /thing/{id} "Get a Thing by ID"
29+
Param id in Path NormalizedString 1 "The sourced ID of the thing"
30+
Response 200 Thing
31+
Responses errors
32+
33+
Operation getAllThings GET /things "Get all the Things"
34+
Params commonQueryParams in
35+
Response 200 Thing 0..* paging
36+
Response Default String
37+
38+
Interface Thangs "t:The Thang Endpoints"
39+
40+
Operation addThang POST /thang Thang "Add a single Thang"
41+
Response 202
42+
Params commonResponseHeaders out
43+
Response Default String
44+
45+
Operation addThangs POST /thangs Thang 1..* "Add multiple Thangs"
46+
Response 202
47+
Params commonResponseHeaders out
48+
Param X-Header-Baz out Header String 0..1
49+
Responses errors
50+
51+
//a reusable group of query parameters
52+
ParamList commonQueryParams
53+
Param query1 in Query String 1
54+
Param query2 in Query Integer 0..1
55+
56+
//a reusable group of response parameters
57+
ParamList commonResponseHeaders
58+
Param X-Header-Foo out Header String 0..1
59+
Param X-Header-Bar out Header Integer 0..1
60+
61+
//a reusable group of responses
62+
ResponseList errors
63+
Response 404
64+
Response 402
65+
Response Default String 0..1
66+
67+
Localizations ca-ES http://localhost:8000/1edtech-examples/model/model_with_localizations_ca_ES.lines
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Model test01 "t:Model de prova 01" "Model de prova 01"
2+
3+
Package DataClasses "Classes de dades"
4+
5+
Class Thing "Cosa"
6+
Property id "identificador"
7+
Property startDate "Data d'inici"
8+
Property endDate "Data de finalització"
9+
10+
Class Thang "Thang"
11+
Property id "identificador"
12+
Property thingRef "referència a Cosa"
13+
Property size "mida"
14+
15+
16+
Package BaseService "Servei Base"
17+
18+
Interface Things "t:Operacions sobre Cosa" "n:primera nota" "n:segona nota"
19+
20+
Operation getThingById "Obtenir una Cosa per ID"
21+
Param id "ID de la cosa"
22+
23+
Operation getAllThings "Obtenir totes les coses"
24+
25+
Interface Thangs "t:Operacions sobre Thang"
26+
27+
Operation addThang "Afegir un Thang"
28+
29+
Operation addThangs "Afegir múltiples Thangs"

1edtech-examples/mps_ca.html

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<!DOCTYPE html>
2+
<html lang="ca-ES">
3+
4+
<head>
5+
<meta charset='utf-8'>
6+
<title>
7+
Exemple d'especificació 1EdTech
8+
</title>
9+
<script src='../profiles/1edtech.js' type="module" class="remove"></script>
10+
11+
<!-- Load the MPS configuration -->
12+
<script class="remove" src="mps-config.js"></script>
13+
<script class="remove" src="mps-auth.js"></script>
14+
15+
<!-- Load ajv2019 (Another JSON Schema Validator) if you want your examples validated -->
16+
<script src="https://cdnjs.cloudflare.com/ajax/libs/ajv/8.8.2/ajv2019.bundle.min.js"
17+
integrity="sha512-9CfeXrjdW9wxGntWtQ4wE0k9RD8avpYxoPEKAGu+EP87RyqXYVQjed0l872XkNtQeIyYavZeqY+jzm69pmjEDw=="
18+
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
19+
20+
<script class='remove'>
21+
22+
var respecConfig = {
23+
specTitle: "Exemple d'especificació 1EdTech",
24+
shortName: "example",
25+
specStatus: "Base Document",
26+
specVersion: "1.0",
27+
docVersion: "1",
28+
specNature: "normative",
29+
specType: "spec",
30+
skipCertGuideConformanceRef: true,
31+
localBiblio: {
32+
"DATA-INTEGRITY": {
33+
title: "Data Integrity 1.0",
34+
href: "https://w3c-ccg.github.io/data-integrity-spec/",
35+
authors: [
36+
"Manu Sporny",
37+
"Dave Longley"
38+
],
39+
status: "CG-DRAFT",
40+
publisher: "Credentials Community Group"
41+
},
42+
"MULTIBASE": {
43+
title: "Multibase"
44+
},
45+
"MULTICODEC": {
46+
title: "Multicodec"
47+
},
48+
"CTDL-TERMS": {
49+
title: "CTDL Terms",
50+
publisher: "Credential Engine"
51+
},
52+
"CTDL-ASN-TERMS": {
53+
title: "CTDL-ASN Terms",
54+
publisher: "Credential Engine"
55+
}
56+
},
57+
58+
// Add the MPS configuration to respecConfig
59+
mps: {..._mps, apiKey: _mpsApiKey},
60+
61+
showPrivacyAnnotations: true,
62+
63+
// Add VC proof examples
64+
// postProcess: [
65+
// window.respecVc.createVcExamples
66+
// ],
67+
};
68+
respecConfig.mps.apiKey = _mpsApiKey;
69+
</script>
70+
</head>
71+
72+
<body>
73+
<section id='abstract'>
74+
<h2>Resum</h2>
75+
<p>Resum molt simple.</p>
76+
<div class="note">
77+
Per que aquest exemple funcioni correctament s'ha de carregar al MPS el model definit a
78+
<code>model/model_with_localizations.lines</code>. Aquest model pressuposa que el servidor
79+
respec està arrencat en el port 8000.
80+
</div>
81+
<div class="note">
82+
In order to work properly, the model defined at <code>model/model_with_localizations.lines</code>
83+
must be sideloaded into MPS. This model assumes respec server is running on port 8000.
84+
</div>
85+
</section>
86+
<section id="conformance" class="informative">
87+
<h2>Conformitat</h2>
88+
</section>
89+
<section>
90+
<h2>Terminologia</h2>
91+
<dl>
92+
<dt><dfn>Authorization Server</dfn></dt>
93+
<dd>Un servidor d'autorització.</dd>
94+
<dt><dfn>Resource Server</dfn></dt>
95+
<dd>Un servidor de recursos.</dd>
96+
<dt><dfn>credential equality and comparison</dfn></dt>
97+
<dd>Un algoritme.</dd>
98+
</dl>
99+
</section>
100+
<section id="data-integrity">
101+
<h2>Integritat</h2>
102+
<p>Aquesta especificació empra els termes definits a l'especificació [[DATA-INTEGRITY]].</p>
103+
</section>
104+
<section id="proofs-signatures">
105+
<h2>Sigantures</h2>
106+
</section>
107+
108+
<!-- Start a data model section-->
109+
<section data-model="org.1edtech.test01.v0p1.model"
110+
data-service-model="org.1edtech.test01.v0p1.servicemodel"
111+
data-source="SANDBOX">
112+
</section>
113+
114+
<section data-model="org.1edtech.test01.v0p1.model" data-package="DataClasses" class="appendix" data-source="SANDBOX"></section>
115+
<section data-model="org.1edtech.test01.v0p1.model" data-stereotype="DerivedType" title="Derived Types" class="appendix" data-source="SANDBOX">
116+
<p>Tipus derivats del Common Data Model.</p>
117+
</section>
118+
<section data-model="org.1edtech.test01.v0p1.model" data-stereotype="PrimitiveType" title="Primitive Types" class="appendix" data-source="SANDBOX"></section>
119+
120+
121+
</body>
122+
123+
</html>

src/1edtech/abstract.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
// Module 1edtech/abstract
33
// Handle the abstract section properly.
44
import { html } from "../core/import-maps.js";
5-
import { showWarning } from "../core/utils.js";
5+
import { getIntlData, showWarning } from "../core/utils.js";
66
export const name = "1edtech/abstract";
77

8+
import localizationStrings from "./translations/abstract.js";
9+
const l10n = getIntlData(localizationStrings);
10+
811
/**
912
* Handles checking for the abstract, and inserts a temp one if not present.
1013
*/
@@ -14,7 +17,7 @@ export async function run() {
1417
showWarning("Document should have one element with 'abstract'", name);
1518
// insert a temp abstract
1619
abstract = html`<section id="abstract" class="introductory remove">
17-
<h2>To be removed</h2>
20+
<h2>${l10n.to_be_removed}</h2>
1821
</section>`;
1922
document.body.prepend(abstract);
2023
}
@@ -35,6 +38,6 @@ export async function run() {
3538
return;
3639
}
3740
abstractHeading = document.createElement("h2");
38-
abstractHeading.textContent = "Abstract";
41+
abstractHeading.textContent = l10n.abstract;
3942
abstract.prepend(abstractHeading);
4043
}

src/1edtech/conformance.js

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
// - Use slightly modified conformance text.
99
//
1010
// Note: Run after inlines so the conformance section has an id and NormativeReferences is available.
11-
import { htmlJoinAnd, showError, showWarning } from "../core/utils.js";
11+
import { getIntlData, htmlJoinAnd, showError, showWarning } from "../core/utils.js";
1212
import { html } from "../core/import-maps.js";
1313
import { renderInlineCitation } from "../core/render-biblio.js";
1414
import { rfc2119Usage } from "../core/inlines.js";
15+
import localizationStrings from "./translations/conformance.js";
16+
const l10n = getIntlData(localizationStrings);
1517

1618
export const name = "1edtech/conformance";
1719

@@ -53,38 +55,28 @@ function getNormativeText(conf) {
5355
const plural = terms.length > 1;
5456

5557
const content = html`<p>
56-
As well as sections marked as non-normative, all authoring guidelines,
57-
diagrams, examples, and notes in this specification are non-normative.
58-
Everything else in this specification is normative.
58+
${l10n.normative_text_paragraph_1}
5959
</p>
6060
${terms.length
6161
? html`
6262
<p>
63-
The key word${plural ? "s" : ""} ${[keywords]} in this document
64-
${plural ? "are" : "is"} to be interpreted as described in
65-
${renderInlineCitation("RFC2119")}.
63+
${plural ? `${l10n.the_plural} ${l10n.key_words}` : `${l10n.the} ${l10n.key_word}`}
64+
${[keywords]}
65+
${l10n.keywords_paragraph
66+
.replace("{0}", plural ? l10n.are : l10n.is)
67+
.replace("{1}", renderInlineCitation("RFC2119"))}
6668
</p>
6769
`
6870
: null}
69-
<p>
70-
An implementation of this specification that fails to implement a
71-
MUST/REQUIRED/SHALL requirement or fails to abide by a MUST NOT/SHALL NOT
72-
prohibition is considered nonconformant. SHOULD/SHOULD NOT/RECOMMENDED
73-
statements constitute a best practice. Ignoring a best practice does not
74-
violate conformance but a decision to disregard such guidance should be
75-
carefully considered. MAY/OPTIONAL statements indicate that implementers
76-
are entirely free to choose whether or not to implement the option.
77-
</p>`;
71+
<p>${l10n.normative_text_implementation}</p>`;
7872

7973
if (conf.skipCertGuideConformanceRef || conf.specType == "cert") {
8074
return content;
8175
}
8276

8377
return html`${content}
8478
<p>
85-
The <a href="#document-set">Conformance and Certification Guide</a>
86-
for this specification may introduce greater normative constraints than
87-
those defined here for specific service or implementation categories.
79+
${l10n.normative_text_certification_constraints}
8880
</p>`;
8981
}
9082

@@ -101,14 +93,8 @@ function getInformativeText(conf) {
10193
}
10294

10395
return html` <p>
104-
This document is an informative resource in the Document Set of the
105-
${conf.mainSpecTitle ? conf.mainSpecTitle : ""} specification
106-
${conf.mainSpecBiblioKey
107-
? renderInlineCitation(conf.mainSpecBiblioKey)
108-
: ""}.
109-
As such, it does not include any normative requirements. Occurrences in this
110-
document of terms such as MAY, MUST, MUST NOT, SHOULD or RECOMMENDED have no
111-
impact on the conformance criteria for implementors of this specification.
96+
${l10n.informative_text_paragraph_1.replace("{0}", conf.mainSpecTitle ? conf.mainSpecTitle : "").replace("{1}", conf.mainSpecBiblioKey ? renderInlineCitation(conf.mainSpecBiblioKey) : "")}.
97+
${l10n.informative_text_paragraph_2}
11298
</p>`;
11399
}
114100

src/1edtech/contrib.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// @ts-check
22

33
import { toHTMLNode } from "./utils.js";
4+
import { getIntlData } from "../core/utils.js";
5+
6+
import localizationStrings from "./translations/contrib.js";
7+
const l10n = getIntlData(localizationStrings);
48

59
export const name = "1edtech/contrib";
610

@@ -10,14 +14,14 @@ export async function run(conf) {
1014
if (conf.specType !== "errata") {
1115
const useRoles = hasRoles(conf.contributors);
1216
const contrib = toHTMLNode(`<section id='contributors' class="appendix">
13-
<h2>List of Contributors</h2>
14-
<p>The following individuals contributed to the development of this document:</p>
15-
<table class="contributors" title="List of Contributors"
16-
summary="The list of contributors to this work.">
17+
<h2>${l10n.title}</h2>
18+
<p>${l10n.intro}</p>
19+
<table class="contributors" title="${l10n.title}"
20+
summary="${l10n.summary}">
1721
<thead>
18-
<th>Name</th>
19-
<th>Organization</th>
20-
${useRoles ? `<th>Role</th>` : ``}
22+
<th>${l10n.name}</th>
23+
<th>${l10n.organization}</th>
24+
${useRoles ? `<th>${l10n.role}</th>` : ``}
2125
</thead>
2226
<tbody>
2327
${personsToTableRows(conf.contributors, useRoles)}

0 commit comments

Comments
 (0)