Skip to content

Commit

Permalink
feat: translate x-rays page
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed-Hacene committed Feb 22, 2024
1 parent bd117e7 commit 2b01fac
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 46 deletions.
6 changes: 5 additions & 1 deletion frontend/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,9 @@
"september": "September",
"october": "October",
"november": "November",
"december": "December"
"december": "December",
"error": "error{s}",
"warning": "warning{s}",
"info": "info{s}",
"found": "found"
}
6 changes: 5 additions & 1 deletion frontend/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@
"september": "Septembre",
"october": "Octobre",
"november": "Novembre",
"december": "Décembre"
"december": "Décembre",
"error": "erreur{s}",
"warning": "avertissement{s}",
"info": "info{s}",
"found": "trouvé{e}{s}"
}

39 changes: 3 additions & 36 deletions frontend/src/lib/components/ModelTable/ModelTable.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import type { AnyZodObject } from 'zod';
import type { TableSource } from './types';
import * as m from '$paraglide/messages';
import { localItems } from '$lib/utils/locales';
import { languageTag } from '$paraglide/runtime';
// Event Dispatcher
type TableEvent = {
selected: string[];
Expand Down Expand Up @@ -120,41 +122,6 @@
// tagged_keys tag_map[key][value]
$: source, handler.setRows(data);
const headTranslate: any = {
name: m.name(),
description: m.description(),
parentDomain: m.parentDomain(),
ref: m.ref(),
refId: m.refId(),
businessValue: m.businessValue(),
email: m.email(),
firstName: m.firstName(),
lastName: m.lastName(),
category: m.category(),
eta: m.eta(),
securityFunction: m.securityFunction(),
provider: m.provider(),
domain: m.domain(),
urn: m.urn(),
id: m.id(),
treatmentStatus: m.treatmentStatus(),
currentLevel: m.currentLevel(),
residualLevel: m.residualLevel(),
riskMatrix: m.riskMatrix(),
riskScenarios: m.riskScenarios(),
project: m.project(),
complianceAssessments: m.complianceAssessments(),
folder: m.folder(),
builtin: m.builtin(),
assets: m.assets(),
threat: m.threat(),
riskAssessment: m.riskAssessment(),
framework: m.framework(),
file: m.file(),
overview: m.overview(),
language: m.language()
}
</script>

<div class="table-container {classesBase}">
Expand All @@ -181,7 +148,7 @@
<thead class="table-head {regionHead}">
<tr>
{#each Object.entries(source.head) as [key, heading]}
<Th {handler} orderBy={key} class="{regionHeadCell}">{headTranslate[heading]}</Th>
<Th {handler} orderBy={key} class="{regionHeadCell}">{localItems(languageTag())[heading]}</Th>
{/each}
{#if displayActions}
<th class="{regionHeadCell} select-none text-end"></th>
Expand Down
41 changes: 33 additions & 8 deletions frontend/src/routes/(app)/x-rays/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import { Tab, TabGroup } from '@skeletonlabs/skeleton';
import type { PageData } from './$types';
import * as m from '$paraglide/messages';
export let data: PageData;
Expand Down Expand Up @@ -47,7 +48,7 @@
</h1>
<TabGroup>
<Tab bind:group={project.tabSet} name="compliance_assessments_tab" value={0}
>Compliance assessments
>{m.complianceAssessments()}
{#if project.compliance_assessments.errors.length > 0}
<span class="badge variant-soft-error"
>{project.compliance_assessments.errors.length}</span
Expand All @@ -65,7 +66,7 @@
{/if}
</Tab>
<Tab bind:group={project.tabSet} name="risk_assessments_tab" value={1}
>Risk assessments
>{m.riskAssessments()}
{#if project.risk_assessments.errors.length > 0}
<span class="badge variant-soft-error">{project.risk_assessments.errors.length}</span>
{/if}
Expand All @@ -91,7 +92,11 @@
<div class="space-y-2">
<div class="variant-soft-error rounded-token px-2 py-1">
<i class="fa-solid fa-bug mr-1" />
{quality_check.errors.length} <span class="font-bold">errors</span> found
{#if quality_check.errors.length === 1}
{quality_check.errors.length} <span class="font-bold">{m.error({s: ''})}</span> {m.found({s: '', e: 'e'})}
{:else}
{quality_check.errors.length} <span class="font-bold">{m.error({s: 's'})}</span> {m.found({s: 's', e: 'e'})}
{/if}
</div>
<ul class="list-disc pl-4 text-sm">
{#each quality_check.errors as error}
Expand All @@ -104,7 +109,11 @@
<div class="space-y-2">
<div class="variant-soft-warning rounded-token px-2 py-1">
<i class="fa-solid fa-triangle-exclamation mr-1" />
{quality_check.warnings.length} <span class="font-bold">warnings</span> found
{#if quality_check.warnings.length === 1}
{quality_check.warnings.length} <span class="font-bold">{m.warning({s: ''})}</span> {m.found({s: '', e: ''})}
{:else}
{quality_check.warnings.length} <span class="font-bold">{m.warning({s: 's'})}</span> {m.found({s: 's', e: ''})}
{/if}
</div>
<ul class="list-disc pl-4 text-sm">
{#each quality_check.warnings as warning}
Expand All @@ -117,7 +126,11 @@
<div class="space-y-2">
<div class="variant-soft-secondary rounded-token px-2 py-1">
<i class="fa-solid fa-circle-info mr-1" />
{quality_check.info.length} <span class="font-bold">infos</span> found
{#if quality_check.infos.length === 1}
{quality_check.infos.length} <span class="font-bold">{m.info({s: ''})}</span> {m.found({s: '', e: 'e'})}
{:else}
{quality_check.infos.length} <span class="font-bold">{m.info({s: 's'})}</span> {m.found({s: 's', e: 'e'})}
{/if}
</div>
<ul class="list-disc pl-4 text-sm">
{#each quality_check.info as info}
Expand Down Expand Up @@ -145,7 +158,11 @@
<div class="space-y-2">
<div class="variant-soft-error rounded-token px-2 py-1">
<i class="fa-solid fa-bug mr-1" />
{quality_check.errors.length} <span class="font-bold">errors</span> found
{#if quality_check.errors.length === 1}
{quality_check.errors.length} <span class="font-bold">{m.error({s: ''})}</span> {m.found({s: '', e: 'e'})}
{:else}
{quality_check.errors.length} <span class="font-bold">{m.error({s: 's'})}</span> {m.found({s: 's', e: 'e'})}
{/if}
</div>
<ul class="list-disc pl-4 text-sm">
{#each quality_check.errors as error}
Expand All @@ -158,7 +175,11 @@
<div class="space-y-2">
<div class="variant-soft-warning rounded-token px-2 py-1">
<i class="fa-solid fa-triangle-exclamation mr-1" />
{quality_check.warnings.length} <span class="font-bold">warnings</span> found
{#if quality_check.warnings.length === 1}
{quality_check.warnings.length} <span class="font-bold">{m.warning({s: ''})}</span> {m.found({s: '', e: ''})}
{:else}
{quality_check.warnings.length} <span class="font-bold">{m.warning({s: 's'})}</span> {m.found({s: 's', e: ''})}
{/if}
</div>
<ul class="list-disc pl-4 text-sm">
{#each quality_check.warnings as warning}
Expand All @@ -171,7 +192,11 @@
<div class="space-y-2">
<div class="variant-soft-secondary rounded-token px-2 py-1">
<i class="fa-solid fa-circle-info mr-1" />
{quality_check.info.length} <span class="font-bold">infos</span> found
{#if quality_check.infos.length === 1}
{quality_check.infos.length} <span class="font-bold">{m.info({s: ''})}</span> {m.found({s: '', e: 'e'})}
{:else}
{quality_check.infos.length} <span class="font-bold">{m.info({s: 's'})}</span> {m.found({s: 's', e: 'e'})}
{/if}
</div>
<ul class="list-disc pl-4 text-sm">
{#each quality_check.info as info}
Expand Down

0 comments on commit 2b01fac

Please sign in to comment.