Skip to content

Commit

Permalink
feat: add EN translations in library view
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed-Hacene committed Feb 26, 2024
1 parent f0a8668 commit 63c6397
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
10 changes: 9 additions & 1 deletion frontend/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,5 +319,13 @@
"lossOfAccountabilityChoice1": "Fully traceable",
"lossOfAccountabilityChoice2": "Possibly traceable",
"lossOfAccountabilityChoice3": "Completely anonymous",
"ignore": "Ignore"
"ignore": "Ignore",
"importedLibraries": "Imported libraries",
"librariesStore": "Libraries store",
"currentlyNoImportedLibraries": "You currently have no imported libraries",
"loadingLibraryUploadButton": "Loading the library upload button",
"errorOccuredWhileLoadingLibrary": "The following error occured while loading the library form",
"packager": "Packager",
"dependencies": "Dependencies",
"copyright": "Copyright"
}
13 changes: 7 additions & 6 deletions frontend/src/routes/(app)/libraries/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { LibraryUploadSchema } from '$lib/utils/schemas';
import * as m from '$paraglide/messages';
import FileInput from '$lib/components/Forms/FileInput.svelte';
import SuperForm from '$lib/components/Forms/Form.svelte';
Expand All @@ -16,12 +17,12 @@
<div class="card bg-white shadow">
<TabGroup>
{#if data.importedLibrariesTable.body.length > 0}
<Tab bind:group={tabSet} value={0}>Imported libraries</Tab>
<Tab bind:group={tabSet} value={1}>Libraries store</Tab>
<Tab bind:group={tabSet} value={0}>{m.importedLibraries()}</Tab>
<Tab bind:group={tabSet} value={1}>{m.librariesStore()}</Tab>
{:else}
<div class="card p-4 variant-soft-secondary w-full m-4">
<i class="fa-solid fa-info-circle mr-2" />
You currently have no imported libraries.
{m.currentlyNoImportedLibraries()}.
</div>
{/if}
<svelte:fragment slot="panel">
Expand All @@ -48,7 +49,7 @@
{#if tabSet === 1}
<div class="card bg-white p-4 mt-4 shadow">
{#await superValidate(LibraryUploadSchema)}
<h1>Loading the library upload button...</h1>
<h1>{m.loadingLibraryUploadButton()}...</h1>
{:then form}
<SuperForm
class="flex flex-col space-y-3"
Expand All @@ -71,11 +72,11 @@
<button
class="btn variant-filled-primary font-semibold w-full"
data-testid="save-button"
type="submit">Save</button
type="submit">{m.save()}</button
>
</SuperForm>
{:catch err}
<h1>The following error occured while loading the library form : {err}</h1>
<h1>{m.errorOccuredWhileLoadingLibrary()}: {err}</h1>
{/await}
</div>
{/if}
13 changes: 7 additions & 6 deletions frontend/src/routes/(app)/libraries/[id=urn]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import RiskMatrix from '$lib/components/RiskMatrix/RiskMatrix.svelte';
import Dropdown from '$lib/components/Dropdown/Dropdown.svelte';
import TreeViewItemContent from '../../frameworks/[id=uuid]/TreeViewItemContent.svelte';
import * as m from '$paraglide/messages';
export let data;
let loading = false;
Expand Down Expand Up @@ -93,12 +94,12 @@
</div>
</span>
<div class="space-y-1">
<p class="text-md leading-5 text-gray-700">Description: {data.library.description}</p>
<p class="text-md leading-5 text-gray-700">Provider: {data.library.provider}</p>
<p class="text-md leading-5 text-gray-700">Packager: {data.library.packager}</p>
<p class="text-md leading-5 text-gray-700">{m.description()}: {data.library.description}</p>
<p class="text-md leading-5 text-gray-700">{m.provider()}: {data.library.provider}</p>
<p class="text-md leading-5 text-gray-700">{m.packager()}: {data.library.packager}</p>
{#if data.library.dependencies}
<p class="text-md leading-5 text-gray-700">
Dependendies:
{m.dependencies()}:
{#each data.library.dependencies as dependency}
<li>
<a href="/libraries/{dependency}" target="_parent" class="anchor">{dependency}</a>
Expand All @@ -107,7 +108,7 @@
</p>
{/if}
{#if data.library.copyright}
<p class="text-sm leading-5 text-gray-500">Copyright: {data.library.copyright}</p>
<p class="text-sm leading-5 text-gray-500">{m.copyright()}: {data.library.copyright}</p>
{/if}
</div>
</div>
Expand Down Expand Up @@ -155,7 +156,7 @@
{/if}

{#if framework}
<h4 class="h4 font-medium">Framework</h4>
<h4 class="h4 font-medium">{m.framework()}</h4>
<RecursiveTreeView nodes={treeViewNodes} hover="hover:bg-initial" />
{/if}
</div>

0 comments on commit 63c6397

Please sign in to comment.