Skip to content

Commit

Permalink
feat: prepare sidebar translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed-Hacene committed Feb 13, 2024
1 parent d53c95d commit 7c8b275
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 40 deletions.
33 changes: 31 additions & 2 deletions frontend/messages/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
{
"$schema": "https://inlang.com/schema/inlang-message-format",
"Home": "Home",
"Overview": "Overview"
"home": "Home",
"overview": "Overview",
"context": "Context",
"governance": "Governance",
"risk": "Risk",
"compliance": "Compliance",
"organisation": "Organisation",
"extra": "Extra",
"analytics": "Analytics",
"calendar": "Calendar",
"threats": "Threats",
"securityFunctions": "Security functions",
"securityMeasures": "Security measures",
"assets": "Assets",
"policies": "Policies",
"riskMatrices": "Risk matrices",
"riskAssessments": "Risk assessments",
"riskScenarios": "Risk scenarios",
"riskAcceptances": "Risk acceptances",
"complianceAssessments": "Compliance assessments",
"evidences": "Evidences",
"frameworks": "Frameworks",
"domains": "Domains",
"projects": "Projects",
"users": "Users",
"userGroups": "User groups",
"roleAssignments": "Role assignments",
"xrays": "X-rays",
"scoringAssistant": "Scoring assistant",
"libraries": "Libraries",
"backupRestore": "Backup & restore"
}
10 changes: 8 additions & 2 deletions frontend/messages/fr.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"$schema": "https://inlang.com/schema/inlang-message-format",
"Home": "Accueil",
"Overview": "Vue d'ensemble"
"home": "Accueil",
"overview": "Vue d'ensemble",
"context": "Contexte",
"governance": "Gouvernance",
"risk": "Risque",
"compliance": "Conformité",
"organisation": "Organisation",
"extra": "Extra"
}
2 changes: 1 addition & 1 deletion frontend/src/lib/components/Breadcrumbs/Breadcrumbs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
};
});
crumbs.unshift({ label: m.Home(), href: '/', icon: 'fa-regular fa-compass' });
crumbs.unshift({ label: m.home(), href: '/', icon: 'fa-regular fa-compass' });
if (crumbs[crumbs.length - 1].label != 'Edit') pageTitle.set(crumbs[crumbs.length - 1].label);
else pageTitle.set('Edit ' + crumbs[crumbs.length - 2].label);
}
Expand Down
19 changes: 15 additions & 4 deletions frontend/src/lib/components/SideBar/SideBarCategory.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
<script lang="ts">
export let item: any; // TODO: type this
export let item: any; // Specify the type of 'item' as a key of 'Sidebar'
import * as m from '$paraglide/messages';
const sidebar: any = {
overview: m.overview(),
context: m.context(),
governance: m.governance(),
risk: m.risk(),
compliance: m.compliance(),
organisation: m.organisation(),
extra: m.extra(),
}
</script>

<span class="whitespace-nowrap text-primary-800 font-semibold uppercase tracking-tighter text-xs"
>{item.name}</span
>
<span class="whitespace-nowrap text-primary-800 font-semibold uppercase tracking-tighter text-xs">
{sidebar[item.name]}
</span>
28 changes: 27 additions & 1 deletion frontend/src/lib/components/SideBar/SideBarItem.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,38 @@
<script lang="ts">
import { page } from '$app/stores';
import * as m from '$paraglide/messages';
export let item: any; // TODO: type this
$: classesActive = (href: string) =>
href === $page.url.pathname
? 'bg-primary-100 text-primary-800'
: 'hover:bg-primary-50 text-gray-800 ';
const items: any = {
analytics: m.analytics(),
calendar: m.calendar(),
threats: m.threats(),
securityFunctions: m.securityFunctions(),
securityMeasures: m.securityMeasures(),
assets: m.assets(),
policies: m.policies(), // Note: Correcting typo in "policies"
riskMatrices: m.riskMatrices(),
riskAssessments: m.riskAssessments(),
riskScenarios: m.riskScenarios(),
riskAcceptances: m.riskAcceptances(),
complianceAssessments: m.complianceAssessments(),
evidences: m.evidences(),
frameworks: m.frameworks(),
domains: m.domains(),
projects: m.projects(),
users: m.users(),
userGroups: m.userGroups(),
roleAssignments: m.roleAssignments(),
xrays: m.xrays(),
scoringAssistant: m.scoringAssistant(),
libraries: m.libraries(),
backupRestore: m.backupRestore()
}
</script>

{#each item as item}
Expand Down
60 changes: 30 additions & 30 deletions frontend/src/lib/components/SideBar/navData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export const navData = {
// ]
// },
{
name: 'Overview',
name: "overview",
items: [
{
name: 'Analytics',
name: 'analytics',
fa_icon: 'fa-solid fa-gauge',
href: '/analytics',
permissions: [
Expand All @@ -27,148 +27,148 @@ export const navData = {
]
},
{
name: 'Calendar',
name: 'calendar',
fa_icon: 'fa-solid fa-calendar-days',
href: '/calendar',
permissions: ['view_event']
}
]
},
{
name: 'Context',
name: 'context',
items: [
{
name: 'Threats',
name: 'threats',
fa_icon: 'fa-solid fa-biohazard',
href: '/threats'
},
{
name: 'Security functions',
name: 'securityFunctions',
fa_icon: 'fa-solid fa-gears',
href: '/security-functions'
},
{
name: 'Security measures',
name: 'securityMeasures',
fa_icon: 'fa-solid fa-fire-extinguisher',
href: '/security-measures'
},
{
name: 'Assets',
name: 'assets',
fa_icon: 'fa-solid fa-gem',
href: '/assets'
}
]
},
{
name: 'Governance',
name: 'governance',
items: [
{
name: 'Policies',
name: 'policies',
fa_icon: 'fa-solid fa-user',
href: '/security-measures'
},
{
name: 'Risk matrices',
name: 'riskMatrices',
fa_icon: 'fa-solid fa-table-cells-large',
href: '/risk-matrices'
}
]
},
{
name: 'Risk',
name: 'risk',
items: [
{
name: 'Risk assessments',
name: 'riskAssessments',
fa_icon: 'fa-solid fa-magnifying-glass-chart',
href: '/risk-assessments'
},
{
name: 'Risk scenarios',
name: 'riskScenarios',
fa_icon: 'fa-solid fa-clone',
href: '/risk-scenarios'
},
{
name: 'Risk acceptances',
name: 'riskAcceptances',
fa_icon: 'fa-solid fa-user-tie',
href: '/risk-acceptances'
}
]
},

{
name: 'Compliance',
name: 'compliance',
items: [
{
name: 'Compliance assessments',
name: 'complianceAssessments',
fa_icon: 'fa-solid fa-arrows-to-eye',
href: '/compliance-assessments'
},
{
name: 'Evidences',
name: 'evidences',
fa_icon: 'fa-solid fa-file',
href: '/evidences'
},
{
name: 'Frameworks',
name: 'frameworks',
fa_icon: 'fa-solid fa-folder',
href: '/frameworks'
}
]
},
{
name: 'Organisation',
name: 'organisation',
items: [
{
name: 'Domains',
name: 'domains',
fa_icon: 'fa-solid fa-diagram-project',
href: '/folders'
},
{
name: 'Projects',
name: 'projects',
fa_icon: 'fa-solid fa-cubes',
href: '/projects'
},
{
name: 'Users',
name: 'users',
fa_icon: 'fa-solid fa-user',
href: '/users'
},
{
name: 'User groups',
name: 'userGroups',
fa_icon: 'fa-solid fa-users',
href: '/user-groups'
},
{
name: 'Role assignments',
name: 'roleAssignments',
fa_icon: 'fa-solid fa-user-tag',
href: '/role-assignments'
}
]
},

{
name: 'Extra',
name: 'extra',
items: [
{
name: 'X-Rays',
name: 'xrays',
fa_icon: 'fa-solid fa-bolt',
href: '/x-rays',
permissions: ['view_riskassessment', 'view_assessment']
},
{
name: 'Scoring assistant',
name: 'scoringAssistant',
fa_icon: 'fa-solid fa-star-half-stroke',
href: '/scoring-assistant',
permissions: ['view_riskmatrix']
},
{
name: 'Libraries',
name: 'libraries',
fa_icon: 'fa-solid fa-folder-plus',
href: '/libraries',
permissions: ['add_threat', 'add_riskmatrix', 'add_securityfunction', 'add_framework']
},
{
name: 'Backup & restore',
name: 'backupRestore',
fa_icon: 'fa-solid fa-floppy-disk',
href: '/backup-restore',
permissions: ['backup']
Expand Down

0 comments on commit 7c8b275

Please sign in to comment.