Frontend: Added json files for language specific titles.
This commit is contained in:
parent
437f2a8a06
commit
bac6fd1da2
5 changed files with 82 additions and 21 deletions
|
@ -16,6 +16,7 @@
|
||||||
import "$lib/css/sidebar.css";
|
import "$lib/css/sidebar.css";
|
||||||
|
|
||||||
export let info;
|
export let info;
|
||||||
|
export let text;
|
||||||
export let footer = null;
|
export let footer = null;
|
||||||
export let containerCv = null;
|
export let containerCv = null;
|
||||||
export let sidebarContainer;
|
export let sidebarContainer;
|
||||||
|
@ -98,14 +99,14 @@
|
||||||
{#if info.interests != null}
|
{#if info.interests != null}
|
||||||
<SidebarComponent
|
<SidebarComponent
|
||||||
icon={mdiStar}
|
icon={mdiStar}
|
||||||
title="Interests"
|
title={text.interests}
|
||||||
description={info.interests}
|
description={info.interests}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{#if info.interests != null}
|
{#if info.interests != null}
|
||||||
<SidebarComponent
|
<SidebarComponent
|
||||||
icon={mdiCogs}
|
icon={mdiCogs}
|
||||||
title="Soft-Skills"
|
title={text.softskills}
|
||||||
description={info.softskills}
|
description={info.softskills}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
16
frontend/src/lib/lang/en.json
Normal file
16
frontend/src/lib/lang/en.json
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"education": "Education",
|
||||||
|
"experience": "Experience",
|
||||||
|
"projects": "Projects",
|
||||||
|
"skills": "Skills",
|
||||||
|
"programming_languages": "Programming Languages",
|
||||||
|
"software": "Software",
|
||||||
|
"languages": "Languages",
|
||||||
|
|
||||||
|
"interests": "Interests",
|
||||||
|
"softskills": "Soft-Skills",
|
||||||
|
|
||||||
|
"madewith": "Made with",
|
||||||
|
"usingsvelte": "using Svelte",
|
||||||
|
"copyright": "All rights reserved, Yohan Boujon"
|
||||||
|
}
|
16
frontend/src/lib/lang/fr.json
Normal file
16
frontend/src/lib/lang/fr.json
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"education": "Éducation",
|
||||||
|
"experience": "Expérience",
|
||||||
|
"projects": "Projets",
|
||||||
|
"skills": "Compétences",
|
||||||
|
"programming_languages": "Langages de programmation",
|
||||||
|
"software": "Logiciels",
|
||||||
|
"languages": "Langues",
|
||||||
|
|
||||||
|
"interests": "Centres d'intérêt",
|
||||||
|
"softskills": "Qualités personnelles",
|
||||||
|
|
||||||
|
"madewith": "Fait avec",
|
||||||
|
"usingsvelte": ", à l'aide de Svelte",
|
||||||
|
"copyright": "Tous droits réservés, Yohan Boujon"
|
||||||
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
|
import {json} from '@sveltejs/kit';
|
||||||
|
|
||||||
export async function load(context) {
|
export async function load(context) {
|
||||||
async function fetchData(data) {
|
async function fetchData(data) {
|
||||||
try {
|
try {
|
||||||
|
@ -17,15 +19,39 @@ export async function load(context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function fetchJSON(lang) {
|
||||||
|
try {
|
||||||
|
const resTemp = await context.fetch(`src/lib/lang/${lang}.json`);
|
||||||
|
if (resTemp.ok == false) {
|
||||||
|
return {
|
||||||
|
status: resTemp.status,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
status: 0, data: await resTemp.json(),
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
status: 500,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Gathering the language
|
// Gathering the language
|
||||||
const lang = context.params.lang;
|
const lang = context.params.lang;
|
||||||
const lang_id = (await fetchData(`get_lang_id/${lang}`)).data.id;
|
const lang_id = (await fetchData(`get_lang_id/${lang}`)).data.id;
|
||||||
|
|
||||||
|
// Gathering texts for languages
|
||||||
|
const text = (await fetchJSON(lang)).data;
|
||||||
|
|
||||||
|
// Gathering data from databse
|
||||||
const infos = [];
|
const infos = [];
|
||||||
const project_software = [];
|
const project_software = [];
|
||||||
const project_programming = [];
|
const project_programming = [];
|
||||||
const dataToGather =
|
const dataToGather = [
|
||||||
[`info/${lang_id}`, `education/${lang_id}`, `experience/${lang_id}`, `project/${lang_id}`, 'hard_skills', 'tags'];
|
`info/${lang_id}`, `education/${lang_id}`, `experience/${lang_id}`,
|
||||||
|
`project/${lang_id}`, 'hard_skills', 'tags'
|
||||||
|
];
|
||||||
for (const url of dataToGather) {
|
for (const url of dataToGather) {
|
||||||
const res = await fetchData(url);
|
const res = await fetchData(url);
|
||||||
if (res.status == 0) {
|
if (res.status == 0) {
|
||||||
|
@ -41,8 +67,7 @@ export async function load(context) {
|
||||||
// infos[4] = hardskills
|
// infos[4] = hardskills
|
||||||
// infos[4][1] = Softwares
|
// infos[4][1] = Softwares
|
||||||
for (let i = 0; i < infos[4][1].length; i++) {
|
for (let i = 0; i < infos[4][1].length; i++) {
|
||||||
const res =
|
const res = await fetchData(`getproject_software/${i + 1}/${lang_id}`);
|
||||||
await fetchData(`getproject_software/${i + 1}/${lang_id}`);
|
|
||||||
if (res.status == 0) {
|
if (res.status == 0) {
|
||||||
project_software.push(res.data);
|
project_software.push(res.data);
|
||||||
} else {
|
} else {
|
||||||
|
@ -53,12 +78,10 @@ export async function load(context) {
|
||||||
}
|
}
|
||||||
// infos[4][0] = Programming Languages
|
// infos[4][0] = Programming Languages
|
||||||
for (let i = 0; i < infos[4][0].length; i++) {
|
for (let i = 0; i < infos[4][0].length; i++) {
|
||||||
const res =
|
const res = await fetchData(`getproject_programming/${i + 1}/${lang_id}`);
|
||||||
await fetchData(`getproject_programming/${i + 1}/${lang_id}`);
|
|
||||||
if (res.status == 0) {
|
if (res.status == 0) {
|
||||||
project_programming.push(res.data);
|
project_programming.push(res.data);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return {
|
return {
|
||||||
status: res.status
|
status: res.status
|
||||||
}
|
}
|
||||||
|
@ -67,6 +90,7 @@ export async function load(context) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
status: 0,
|
status: 0,
|
||||||
|
lang: lang,
|
||||||
info: infos[0],
|
info: infos[0],
|
||||||
education: infos[1],
|
education: infos[1],
|
||||||
experience: infos[2],
|
experience: infos[2],
|
||||||
|
@ -79,5 +103,6 @@ export async function load(context) {
|
||||||
tags: infos[5],
|
tags: infos[5],
|
||||||
project_programming: project_programming,
|
project_programming: project_programming,
|
||||||
project_software: project_software,
|
project_software: project_software,
|
||||||
|
text: text,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,10 @@
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
// Database
|
||||||
const cv = data.status == 0 ? processData(data) : undefined;
|
const cv = data.status == 0 ? processData(data) : undefined;
|
||||||
|
// Language specifications
|
||||||
|
const text = data.text;
|
||||||
|
|
||||||
// Sidebar
|
// Sidebar
|
||||||
let containerCv;
|
let containerCv;
|
||||||
|
@ -81,12 +84,12 @@
|
||||||
<ProjectsPopup tags={cv.tags} />
|
<ProjectsPopup tags={cv.tags} />
|
||||||
<!-- TOPBAR DIV (POPUP: mobile) -->
|
<!-- TOPBAR DIV (POPUP: mobile) -->
|
||||||
{#if innerWidth < 1200 && sidebarLoaded}
|
{#if innerWidth < 1200 && sidebarLoaded}
|
||||||
<Sidebar info={cv.info} bind:sidebarContainer />
|
<Sidebar info={cv.info} bind:sidebarContainer {text} />
|
||||||
{/if}
|
{/if}
|
||||||
<div class="container-cv" bind:this={containerCv}>
|
<div class="container-cv" bind:this={containerCv}>
|
||||||
<!-- SIDEBAR DIV (LEFT: desktop) -->
|
<!-- SIDEBAR DIV (LEFT: desktop) -->
|
||||||
{#if innerWidth >= 1200 && sidebarLoaded}
|
{#if innerWidth >= 1200 && sidebarLoaded}
|
||||||
<Sidebar info={cv.info} {footer} {containerCv} />
|
<Sidebar info={cv.info} {footer} {containerCv} {text} />
|
||||||
{/if}
|
{/if}
|
||||||
<!-- MOBILE TOP BAR -->
|
<!-- MOBILE TOP BAR -->
|
||||||
{#if innerWidth < 1000}
|
{#if innerWidth < 1000}
|
||||||
|
@ -106,24 +109,24 @@
|
||||||
<h1 class="name">{cv.info.full_name}</h1>
|
<h1 class="name">{cv.info.full_name}</h1>
|
||||||
{/if}
|
{/if}
|
||||||
<h2 class="name">Apprentice Engineer Automatic/Electronic</h2>
|
<h2 class="name">Apprentice Engineer Automatic/Electronic</h2>
|
||||||
<Section icon={mdiSchool} title="Education" />
|
<Section icon={mdiSchool} title={text.education} />
|
||||||
<SlideShow
|
<SlideShow
|
||||||
data={cv.education}
|
data={cv.education}
|
||||||
type={Education}
|
type={Education}
|
||||||
timeline="true"
|
timeline="true"
|
||||||
reverse="true"
|
reverse="true"
|
||||||
/>
|
/>
|
||||||
<Section icon={mdiBriefcase} title="Experience" />
|
<Section icon={mdiBriefcase} title={text.experience} />
|
||||||
<SlideShow
|
<SlideShow
|
||||||
data={cv.experiences}
|
data={cv.experiences}
|
||||||
type={Experience}
|
type={Experience}
|
||||||
timeline="true"
|
timeline="true"
|
||||||
reverse="true"
|
reverse="true"
|
||||||
/>
|
/>
|
||||||
<Section icon={mdiWrench} title="Projects" />
|
<Section icon={mdiWrench} title={text.projects} />
|
||||||
<SlideShow data={cv.skills.project} type={Projects} />
|
<SlideShow data={cv.skills.project} type={Projects} />
|
||||||
<Section icon={mdiPencil} title="Skills" />
|
<Section icon={mdiPencil} title={text.skills} />
|
||||||
<SubSection icon={mdiXml} title="Programming Languages" />
|
<SubSection icon={mdiXml} title={text.programming_languages} />
|
||||||
<div class="subsection">
|
<div class="subsection">
|
||||||
{#if sidebarLoaded}
|
{#if sidebarLoaded}
|
||||||
{#each cv.skills.programming_languages as pilldata, index (index)}
|
{#each cv.skills.programming_languages as pilldata, index (index)}
|
||||||
|
@ -138,7 +141,7 @@
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<SubSection icon={mdiApplication} title="Software" />
|
<SubSection icon={mdiApplication} title={text.software} />
|
||||||
<div class="subsection">
|
<div class="subsection">
|
||||||
{#if sidebarLoaded}
|
{#if sidebarLoaded}
|
||||||
{#each cv.skills.softwares as pilldata, index (index)}
|
{#each cv.skills.softwares as pilldata, index (index)}
|
||||||
|
@ -153,7 +156,7 @@
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<SubSection icon={mdiEarth} title="Languages" />
|
<SubSection icon={mdiEarth} title={text.languages} />
|
||||||
<div class="subsection flag-container end">
|
<div class="subsection flag-container end">
|
||||||
{#each cv.skills.languages as langdata}
|
{#each cv.skills.languages as langdata}
|
||||||
<FlagComponent
|
<FlagComponent
|
||||||
|
@ -167,9 +170,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="footer" bind:this={footer}>
|
<div class="footer" bind:this={footer}>
|
||||||
<p>
|
<p>
|
||||||
Made with <SvgIcon size="20" path={mdiHeart} type="mdi" /> using Svelte
|
{text.madewith} <SvgIcon size="20" path={mdiHeart} type="mdi" /> {text.usingsvelte}
|
||||||
</p>
|
</p>
|
||||||
<p>All rights reserved, Yohan Boujon • {new Date().getFullYear()}</p>
|
<p>{text.copyright} • {new Date().getFullYear()}</p>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<h1 class="h1 text-center">Oops, could not load database :/</h1>
|
<h1 class="h1 text-center">Oops, could not load database :/</h1>
|
||||||
|
|
Loading…
Add table
Reference in a new issue