Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate severity levels and module names in result page #463

Merged
merged 6 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/FR22.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test.describe('Zonemaster test FR22 - [Provide the possibility to see more infor
const basic02Messages = page.locator('#testcase-entries-BASIC02 li');

await expect(basicHeader).toBeVisible({ timeout: 10000 });
await expect(basicHeader).toHaveText(/BASIC/);
await expect(basicHeader).toHaveText(/Basic/i);

await expect(basicTestcases).toHaveCount(3);

Expand Down
2 changes: 1 addition & 1 deletion src/app/components/result/result.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@
}

.result section.testcase header {
flex-direction: column;
flex-wrap: wrap;
}

.result section.testcase header .test-case-id {
Expand Down
12 changes: 6 additions & 6 deletions src/app/components/result/result.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ <h3>
>
<i class="fa fa-caret-right caret" aria-hidden="true"></i>
<span class="module-name">
{{module.name}}<span class="sr-only" i18n="result colon">:</span>
{{getModuleName(module.name)}}<span class="sr-only" i18n="result colon">:</span>
</span>
<span *ngFor="let count of testCasesCountByModule[module.name]; let last = last;" class="badge badge-pill rounded-pill {{ count.name }}" title="{{ count.name | titlecase }} ({{ count.value }})">
<span *ngFor="let count of testCasesCountByModule[module.name]; let last = last;" class="badge badge-pill rounded-pill {{ count.name }}" title="{{ severityLevelNames[count.name] }} ({{ count.value }})">
<span aria-hidden="true">
<i class="fa {{severity_icons[count.name]}}"></i> {{ count.value }}
</span>
<span class="sr-only">{{ count.name }} ({{ count.value }})<ng-container *ngIf="!last">, </ng-container></span>
<span class="sr-only">{{ severityLevelNames[count.name] | lowercase }} ({{ count.value }})<ng-container *ngIf="!last">, </ng-container></span>
</span>
</button>
</h3>
Expand All @@ -200,17 +200,17 @@ <h4>
<i class="fa" aria-hidden="true" [ngClass]="{'fa-plus-square-o': isCollapsed[testcase.id],'fa-minus-square-o': !isCollapsed[testcase.id]}"></i>

<span class="testcase-name">
<i class="fa {{severity_icons[testcase.level]}}" aria-hidden="true" title="{{ testcase.level | titlecase }}"></i><span class="sr-only">{{ testcase.level | titlecase }}: </span>{{ testCaseDescriptions[testcase.id] }}
<i class="fa {{severity_icons[testcase.level]}}" aria-hidden="true" title="{{ severityLevelNames[testcase.level] }}"></i><span class="sr-only">{{ severityLevelNames[testcase.level] }}: </span>{{ testCaseDescriptions[testcase.id] }}
</span>
</button>
</h4>
<span class="test-case-id" [class.collapsed]="isCollapsed[testcase.id]" id="testcase-id-{{testcase.id}}">
<span class="test-case-id" [class.collapsed]="isCollapsed[testcase.id]" id="testcase-id-{{testcase.id}}" lang="en">
<i class="fa fa-info-circle" aria-hidden="true"></i> {{testcase.id}}
</span>
</header>
<div [class.collapsed]="isCollapsed[testcase.id]" [attr.id]="testcase.id === 'UNSPECIFIED' ? null : 'testcase-entries-' + testcase.id">
<ul>
<li *ngFor="let entry of testcase.entries"><div><span class="level {{entry.level|lowercase}}">{{entry.level | titlecase}}</span></div><p> {{entry.message}} </p></li>
<li *ngFor="let entry of testcase.entries"><div><span class="level {{entry.level|lowercase}}">{{ severityLevelNames[entry.level] }}</span></div><p> {{entry.message}} </p></li>
</ul>
</div>
</section>
Expand Down
34 changes: 31 additions & 3 deletions src/app/components/result/result.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,26 @@ export class ResultComponent implements OnInit, OnDestroy {
'warning': 'fa-exclamation-triangle',
'error': 'fa-times-circle',
'critical': 'fa-times-circle'
}
};
public severityLevelNames = {
'info': $localize `Info`,
'notice': $localize `Notice`,
'warning': $localize `Warning`,
'error': $localize `Error`,
'critical': $localize `Critical`,
};
public moduleNames = {
'system': $localize `System`,
'basic': $localize `Basic`,
'address': $localize `Address`,
'connectivity': $localize `Connectivity`,
'consistency': $localize `Consistency`,
'delegation': $localize `Delegation`,
'dnssec': $localize `DNSSEC`,
'nameserver': $localize `Nameserver`,
'syntax': $localize `Syntax`,
'zone': $localize `Zone`,
Comment on lines +44 to +53
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a list of the current modules. What is a new module name comes, e.g. the name of a custom module?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s a limitation of the current design. Shouldn’t these module names be moved over to Zonemaster::Engine, eventually?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If custom module names just show up untranslated, it is fine. If they disappear, it is not fine

I think we should consider moving it to Engine later but it is fine to have it in GUI for now.

};
public searchQueryLength = 0;
public test: any = {params: {ipv4: false, ipv6: false}};
public isCollapsed = [];
Expand Down Expand Up @@ -268,6 +287,15 @@ export class ResultComponent implements OnInit, OnDestroy {
}
}

public getModuleName(moduleName) {
const moduleKey = moduleName.toLowerCase();
if (moduleKey in this.moduleNames) {
return this.moduleNames[moduleKey];
} else {
return moduleName;
}
}

private exportedName(extension) {
return `zonemaster_result_${this.form.domain}_${this.test.id}.${extension}`
}
Expand All @@ -285,8 +313,8 @@ export class ResultComponent implements OnInit, OnDestroy {
for (let item of this.result) {
tbodyContent += `
<tr>
<td>${item.module}</td>
<td>${item.level}</td>
<td>${this.getModuleName(item.module)}</td>
<td>${this.severityLevelNames[item.level.toLowerCase()]}</td>
<td>${item.message}</td>
</tr>
`;
Expand Down
62 changes: 61 additions & 1 deletion src/locale/messages.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,66 @@
<target state="translated">Si le résultat du test ne comporte aucune erreur ni avertissement, on peut être relativement certain que le nouvel emplacement du domaine fonctionne bien. Mais cela n&apos;exclut pas l&apos;existence d&apos;autres problèmes dans les données elles-mêmes de la zone que ce test n&apos;aurait pas décelés.</target>
<note priority="1" from="description">faq answer</note>
</trans-unit>
<trans-unit id="314315645942131479" datatype="html">
<source>Info</source>
<target state="translated">Info</target>
</trans-unit>
<trans-unit id="3042471551767868839" datatype="html">
<source>Notice</source>
<target state="translated">Note</target>
</trans-unit>
<trans-unit id="6759205696902713848" datatype="html">
<source>Warning</source>
<target state="translated">Avertissement</target>
</trans-unit>
<trans-unit id="1519954996184640001" datatype="html">
<source>Error</source>
<target state="translated">Erreur</target>
</trans-unit>
<trans-unit id="2437478124199610198" datatype="html">
<source>Critical</source>
<target state="translated">Critique</target>
</trans-unit>
<trans-unit id="29832309535656200" datatype="html">
<source>System</source>
<target state="translated">Système</target>
</trans-unit>
<trans-unit id="8643289769990675407" datatype="html">
<source>Basic</source>
<target state="translated">Basique</target>
</trans-unit>
<trans-unit id="6304432362546770951" datatype="html">
<source>Address</source>
<target state="translated">Adresse</target>
</trans-unit>
<trans-unit id="2887948366226336935" datatype="html">
<source>Connectivity</source>
<target state="translated">Connectivité</target>
</trans-unit>
<trans-unit id="3001437232085577983" datatype="html">
<source>Consistency</source>
<target state="translated">Cohérence</target>
</trans-unit>
<trans-unit id="5757082283695749077" datatype="html">
<source>Delegation</source>
<target state="translated">Délégation</target>
</trans-unit>
<trans-unit id="6477785032659147345" datatype="html">
<source>DNSSEC</source>
<target state="translated">DNSSEC</target>
</trans-unit>
<trans-unit id="6534302992540929721" datatype="html">
<source>Nameserver</source>
<target state="translated">Serveur de nom</target>
</trans-unit>
<trans-unit id="5797351340797536" datatype="html">
<source>Syntax</source>
<target state="translated">Syntaxe</target>
</trans-unit>
<trans-unit id="4378147649219625174" datatype="html">
<source>Zone</source>
<target state="translated">Zone</target>
</trans-unit>
</body>
</file>
</xliff>
</xliff>
117 changes: 111 additions & 6 deletions src/locale/messages.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -360,35 +360,35 @@
<source>No data for this test.</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">169</context>
<context context-type="linenumber">188</context>
</context-group>
</trans-unit>
<trans-unit id="2360715491728178990" datatype="html">
<source>History information request is in progress.</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">256</context>
<context context-type="linenumber">275</context>
</context-group>
</trans-unit>
<trans-unit id="1867992058937397585" datatype="html">
<source>Module</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">340</context>
<context context-type="linenumber">359</context>
</context-group>
</trans-unit>
<trans-unit id="3733215288982610673" datatype="html">
<source>Level</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">341</context>
<context context-type="linenumber">360</context>
</context-group>
</trans-unit>
<trans-unit id="8066608938393600549" datatype="html">
<source>Message</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">342</context>
<context context-type="linenumber">361</context>
</context-group>
</trans-unit>
<trans-unit id="7104935342812835081" datatype="html">
Expand Down Expand Up @@ -511,7 +511,7 @@
<source>No previous tests found for this domain.</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">261</context>
<context context-type="linenumber">280</context>
</context-group>
</trans-unit>
<trans-unit id="7210131782873551503" datatype="html">
Expand Down Expand Up @@ -1467,6 +1467,111 @@
</context-group>
<note priority="1" from="description">faq answer</note>
</trans-unit>
<trans-unit id="1519954996184640001" datatype="html">
<source>Error</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">40</context>
</context-group>
</trans-unit>
<trans-unit id="2437478124199610198" datatype="html">
<source>Critical</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">41</context>
</context-group>
</trans-unit>
<trans-unit id="3042471551767868839" datatype="html">
<source>Notice</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">38</context>
</context-group>
</trans-unit>
<trans-unit id="314315645942131479" datatype="html">
<source>Info</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">37</context>
</context-group>
</trans-unit>
<trans-unit id="6759205696902713848" datatype="html">
<source>Warning</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">39</context>
</context-group>
</trans-unit>
<trans-unit id="2887948366226336935" datatype="html">
<source>Connectivity</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">47</context>
</context-group>
</trans-unit>
<trans-unit id="29832309535656200" datatype="html">
<source>System</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">44</context>
</context-group>
</trans-unit>
<trans-unit id="3001437232085577983" datatype="html">
<source>Consistency</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">48</context>
</context-group>
</trans-unit>
<trans-unit id="4378147649219625174" datatype="html">
<source>Zone</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">53</context>
</context-group>
</trans-unit>
<trans-unit id="5757082283695749077" datatype="html">
<source>Delegation</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">49</context>
</context-group>
</trans-unit>
<trans-unit id="5797351340797536" datatype="html">
<source>Syntax</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">52</context>
</context-group>
</trans-unit>
<trans-unit id="6304432362546770951" datatype="html">
<source>Address</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">46</context>
</context-group>
</trans-unit>
<trans-unit id="6477785032659147345" datatype="html">
<source>DNSSEC</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">50</context>
</context-group>
</trans-unit>
<trans-unit id="6534302992540929721" datatype="html">
<source>Nameserver</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">51</context>
</context-group>
</trans-unit>
<trans-unit id="8643289769990675407" datatype="html">
<source>Basic</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/result/result.component.ts</context>
<context context-type="linenumber">45</context>
</context-group>
</trans-unit>
</body>
</file>
</xliff>
Loading