From 90ea40971c965ef5b7341cdd00f350769b120c31 Mon Sep 17 00:00:00 2001 From: monsieurswag Date: Wed, 16 Oct 2024 11:28:45 +0200 Subject: [PATCH 01/14] Change localItems usage to safeTranslate usage --- .../lib/components/Chart/RadarChart.svelte | 5 +-- .../Forms/AutocompleteSelect.svelte | 7 ++-- .../Modals/MissingConstraintsModal.svelte | 6 +-- .../components/ModelTable/ModelTable.svelte | 10 ++--- frontend/src/lib/utils/constants.ts | 2 - .../[id=uuid]/+page.server.ts | 9 +++-- .../(app)/(internal)/analytics/+page.svelte | 4 +- .../analytics/composer/+page.svelte | 3 -- .../frameworks/[id=uuid]/+page.svelte | 5 ++- .../(internal)/libraries/+page.server.ts | 4 +- .../libraries/[id=uuid]/+page.server.ts | 3 +- .../(app)/(internal)/my-profile/+page.svelte | 4 +- .../risk-assessments/[id=uuid]/+page.svelte | 5 ++- .../risk-scenarios/[id=uuid]/+page.svelte | 39 ++++++++++--------- .../[id=uuid]/edit/+page.svelte | 5 ++- .../[id=uuid]/edit/RiskLevel.svelte | 7 ++-- .../scoring-assistant/selector.svelte | 7 ++-- .../(app)/(internal)/x-rays/+page.svelte | 14 +++---- .../+page.server.ts | 2 - .../[id=uuid]/+page.svelte | 9 +++-- .../evidences/[id=uuid]/+page.svelte | 5 ++- .../[id=uuid]/edit/+page.svelte | 7 ++-- frontend/tests/functional/nav.test.ts | 3 +- 23 files changed, 83 insertions(+), 82 deletions(-) diff --git a/frontend/src/lib/components/Chart/RadarChart.svelte b/frontend/src/lib/components/Chart/RadarChart.svelte index 87620fdd8..8300a450b 100644 --- a/frontend/src/lib/components/Chart/RadarChart.svelte +++ b/frontend/src/lib/components/Chart/RadarChart.svelte @@ -1,7 +1,6 @@ -
{localItems()[text]}
+
{safeTranslate(text)}
diff --git a/frontend/src/routes/(app)/(internal)/x-rays/+page.svelte b/frontend/src/routes/(app)/(internal)/x-rays/+page.svelte index f099071c6..641d8c88a 100644 --- a/frontend/src/routes/(app)/(internal)/x-rays/+page.svelte +++ b/frontend/src/routes/(app)/(internal)/x-rays/+page.svelte @@ -2,7 +2,7 @@ import { Tab, TabGroup } from '@skeletonlabs/skeleton'; import type { PageData } from './$types'; import * as m from '$paraglide/messages'; - import { localItems } from '$lib/utils/locales'; + import { safeTranslate } from '$lib/utils/i18n'; export let data: PageData; const aggregateQualityChecks = (item: any) => { @@ -117,7 +117,7 @@ {#if error.object.name}{error.object.name}:{/if} - {localItems()[error.msgid]} + {safeTranslate(error.msgid)} {/each} @@ -141,7 +141,7 @@ {#if warning.object.name} {warning.object.name}: {/if} - {localItems()[warning.msgid]} + {safeTranslate(warning.msgid)} {/each} @@ -165,7 +165,7 @@ {#if info.object.name}{info.object.name}:{/if} - {localItems()[info.msgid]} + {safeTranslate(info.msgid)} {/each} @@ -207,7 +207,7 @@ {#if error.object.name}{error.object.name}:{/if} - {localItems()[error.msgid]} + {safeTranslate(error.msgid)} {/each} @@ -231,7 +231,7 @@ {#if warning.object.name}{warning.object.name}:{/if} - {localItems()[warning.msgid]} + {safeTranslate(warning.msgid)} {/each} @@ -255,7 +255,7 @@ {#if info.object.name}{info.object.name}:{/if} - {localItems()[info.msgid]} + {safeTranslate(info.msgid)} {/each} diff --git a/frontend/src/routes/(app)/(third-party)/[model=thirdparty_urlmodels]/+page.server.ts b/frontend/src/routes/(app)/(third-party)/[model=thirdparty_urlmodels]/+page.server.ts index fdfe3c5e5..174765ed0 100644 --- a/frontend/src/routes/(app)/(third-party)/[model=thirdparty_urlmodels]/+page.server.ts +++ b/frontend/src/routes/(app)/(third-party)/[model=thirdparty_urlmodels]/+page.server.ts @@ -5,8 +5,6 @@ import { urlParamModelSelectFields, urlParamModelVerboseName } from '$lib/utils/crud'; -import { safeTranslate } from '$lib/utils/i18n'; -import { localItems } from '$lib/utils/locales'; import { modelSchema } from '$lib/utils/schemas'; import type { ModelInfo } from '$lib/utils/types'; import * as m from '$paraglide/messages'; diff --git a/frontend/src/routes/(app)/(third-party)/compliance-assessments/[id=uuid]/+page.svelte b/frontend/src/routes/(app)/(third-party)/compliance-assessments/[id=uuid]/+page.svelte index ddcd3faa7..79fb6c824 100644 --- a/frontend/src/routes/(app)/(third-party)/compliance-assessments/[id=uuid]/+page.svelte +++ b/frontend/src/routes/(app)/(third-party)/compliance-assessments/[id=uuid]/+page.svelte @@ -26,7 +26,8 @@ import { URL_MODEL_MAP } from '$lib/utils/crud'; import type { Node } from './types'; - import { localItems, toCamelCase } from '$lib/utils/locales'; + import { toCamelCase } from '$lib/utils/locales'; + import { safeTranslate } from '$lib/utils/i18n'; import * as m from '$paraglide/messages'; export let data: PageData; @@ -202,7 +203,7 @@ {#if key === 'urn'} {m.urn()} {:else} - {localItems()[toCamelCase(key)]} + {safeTranslate(toCamelCase(key))} {/if}