From 3800e7b3d33dd40df16f6d61720faa615e9b6b70 Mon Sep 17 00:00:00 2001 From: axherrm Date: Fri, 15 Dec 2023 16:56:30 +0100 Subject: [PATCH] start template documentation --- README.md | 26 ++++++++++++++++++++++++++ src/app/data/data.service.ts | 6 ++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e78cd7b..d40bade 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,28 @@ This is the development project for the Curriculum Vitae of Axel Herrmann. See the newest deployed version at https://axherrm.github.io/CV/ +## How to fill the template + +All data displayed on the CV is stored in [src/data]. +Use the following steps to insert your own data: +> ### 1. [languages.json] +> +> This file contains a definition of the languages that can be used in the CV as well as a definition of section headings etc. for each language. +> if all languages you want to use are defined you only need to adjust the languages array. +> +> | Field | Description | +> |-----------------------|---------------------------------------------------------------------------------------------| +> | `languages` | Array of IDs of all available languages | +> | `defaultLanguage` | ID of language that should be used when no locale could be determined | +> | `${IDs of languages}` | Each of the above listed languages needs a `LanguagePack` object like defined in [model.ts] | +> +> ### 2. Other JSON files +> +> The other JSON in [src/data] contain the user specific data. +> All languages that are configured in the previous step in [languages.json] need an entry in each of these files. +> For the definition of the obejcts to define refer to [model.ts]. +> + ## Development server Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files. @@ -10,3 +32,7 @@ Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The appli ## Build Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. + +[src/data]: src/data +[languages.json]: src/data/languages.json +[model.ts]: src/app/data/model.ts diff --git a/src/app/data/data.service.ts b/src/app/data/data.service.ts index 1208917..ac2ebf7 100644 --- a/src/app/data/data.service.ts +++ b/src/app/data/data.service.ts @@ -39,8 +39,10 @@ export class DataService { lang = navigator.language; if (lang) { lang = lang.trim().split("-")[0]; - this.setLang(lang); - return; + if (this.loadedLanguages.includes(lang)) { + this.setLang(lang); + return; + } } this.setLang(this.defaultLang); }