Merge branch 'dev' into chore/logging
This commit is contained in:
commit
6d05978568
13 changed files with 133 additions and 32 deletions
|
@ -1,5 +1,22 @@
|
|||
# translate theme pages
|
||||
|
||||
strengths:
|
||||
title: Unsere Stärken
|
||||
innovative: Innovativ
|
||||
research_based: Forschungsbasiert
|
||||
inclusive: Inclusiv
|
||||
socially_relevant: Gesellschaftlich relevant
|
||||
innovative_text: Wir fügen ständig neue Projekte hinzu und gebrauchen neue Methoden für alle unsere Projekte.
|
||||
research_based_text: Alle Lernpakete basieren auf fundierter wissenschaftlicher Forschung.
|
||||
inclusive_text: Wir konzentrieren uns darauf, alle Kinder zu erreichen, mit besonderem Augenmerk auf die Geschlechterinklusion und die soziale Inklusion.
|
||||
socially_relevant_text: Wir suchen Projekte, die zu aktuellen Ereignissen und gesellschaftlichen Themen passen.
|
||||
summary: We develop innovative workshops and educational resources, and we provide them to students around the globe in collaboration with teachers and volunteers. Our train-the-trainer sessions enable them to bring our hands-on workshops to the students.
|
||||
main: Wir fügen kontinuierlich neue Projekte und Methoden zu all unseren Projekten hinzu. Für diese Projekte suchen wir immer nach einem gesellschaftlich relevanten Thema. Darüber hinaus stellen wir sicher, dass unser didaktisches Material auf wissenschaftlicher Forschung basiert, und wir achten immer auf Inklusivität.
|
||||
quote:
|
||||
text: Du machst etwas Praktisches, du lernst mit Hardware zu arbeiten und du kannst etwas Neues schaffen.
|
||||
name: Matthias und Bruno
|
||||
affiliation: 4. Jahr der weiterführenden Schule
|
||||
|
||||
curricula_page:
|
||||
title: Unsere Unterrichtsthemen
|
||||
read_more: Lees meer
|
||||
|
|
|
@ -1,5 +1,23 @@
|
|||
# translate theme pages
|
||||
|
||||
strengths:
|
||||
title: Our strengths
|
||||
innovative: Innovative
|
||||
research_based: Research-based
|
||||
inclusive: Inclusive
|
||||
socially_relevant: Socially relevant
|
||||
innovative_text: We continuously add new projects and apply new methodologies in our projects.
|
||||
research_based_text: All learning materials of Dwengo are based on profound scientific research.
|
||||
inclusive_text: We target all children, making gender inclusion and accessibility for disadvantaged children a priority.
|
||||
socially_relevant_text: We look for projects that fit current events and are socially relevant.
|
||||
summary: We develop innovative workshops and educational resources, and we provide them to students around the globe in collaboration with teachers and volunteers. Our train-the-trainer sessions enable them to bring our hands-on workshops to the students.
|
||||
main: We continuously add new projects and methodologies to all our projects. For these projects, we always look for a socially relevant theme. Additionally, we ensure that our didactic material is based on scientific research and always keep an eye on inclusivity.
|
||||
quote:
|
||||
text: You make something practical, learn how to use the hardware and create something new.
|
||||
name: Matthias and Bruno
|
||||
affiliation: Grade 10
|
||||
|
||||
|
||||
curricula_page:
|
||||
title: Our teaching topics
|
||||
read_more: Read more
|
||||
|
|
|
@ -1,5 +1,22 @@
|
|||
# translate theme pages
|
||||
|
||||
strengths:
|
||||
title: Nos atouts
|
||||
innovative: Innovatif
|
||||
research_based: Fondé sur la recherche
|
||||
inclusive: Inclusif
|
||||
socially_relevant: Socialement pertinent
|
||||
innovative_text: On ajoute fréquemment de nouveaux projets et utilise de nouvelles méthodologies dans les projets.
|
||||
research_based_text: Tout le matériel de cours de Dwengo ASBL est fondé sur la recherche scientifique profonde.
|
||||
inclusive_text: On se concentre à atteindre tous les enfants avec une attention particulière pour l'égalite de genre et l'inclusion sociale.
|
||||
socially_relevant_text: Nous recherchons des projects qui s'inscrivent dans l'actualité et les thèmes sociaux.
|
||||
summary: Nous développons des ateliers innovants et des ressources éducatives, et nous les fournissons aux étudiants du monde entier en collaboration avec les enseignants et les bénévoles.Nos séances de train-Trainer leur permettent d'amener nos ateliers pratiques aux étudiants.
|
||||
main: Nous ajoutons toujours de nouveaux projets et méthodologies à tous nos projets.Nous recherchons toujours un thème socialement pertinent pour ces projets.De plus, nous nous assurons toujours que notre matériel didactique est basé sur la recherche scientifique et nous gardons également un œil sur l'inclusivité.
|
||||
quote:
|
||||
text: Vous faites quelque chose de pratique, vous apprenez à travailler avec du matériel et vous pouvez exécuter quelque chose de nouveau Cre & Euml;
|
||||
name: Matthias en Bruno
|
||||
affiliation: 4e milieu
|
||||
|
||||
curricula_page:
|
||||
title: Notre sujets d'enseignement
|
||||
read_more: "Lees meer"
|
||||
|
|
|
@ -1,5 +1,22 @@
|
|||
# translate theme pages
|
||||
|
||||
strengths:
|
||||
title: Verrijk je lessen met AI en robotica!
|
||||
innovative: Innovatief
|
||||
research_based: Onderzoeksgedreven
|
||||
inclusive: Inclusief
|
||||
socially_relevant: Maatschappelijk relevant
|
||||
innovative_text: We voegen steeds nieuwe projecten en methodieken toe aan onze projecten.
|
||||
research_based_text: Alle lespakketten van Dwengo vzw zijn gebaseerd op gedegen wetenschappelijk onderzoek.
|
||||
inclusive_text: We richten ons op alle kinderen en jongeren met een specifieke aandacht voor het evenwicht tussen meisjes en jongens en leerlingen uit kansengroepen.
|
||||
socially_relevant_text: We zoeken projecten uit die passen binnen de actualiteit en maatschappelijke thema's.
|
||||
summary: ""
|
||||
main: Al onze pakketten zijn gebruiksvriendelijk, maatschappelijk relevant, wetenschappelijk onderbouwd, én inclusief. Leerkrachten over de hele wereld gingen hiermee reeds aan de slag. Jij ook? Verken de lesthema's op onze website!
|
||||
quote:
|
||||
text: Je maakt iets praktisch, je leert werken met hardware en je kan zelf iets nieuws creëren.
|
||||
name: Matthias en Bruno
|
||||
affiliation: 4e middelbaar
|
||||
|
||||
curricula_page:
|
||||
title: Onze lesthema's
|
||||
read_more: Lees meer
|
||||
|
|
10
backend/config.ts
Normal file
10
backend/config.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
// Can be placed in dotenv but found it redundant
|
||||
|
||||
// Import dotenv from "dotenv";
|
||||
|
||||
// Load .env file
|
||||
// Dotenv.config();
|
||||
|
||||
export const DWENGO_API_BASE = 'https://dwengo.org/backend/api';
|
||||
|
||||
export const FALLBACK_LANG = 'nl';
|
|
@ -1,39 +1,17 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import yaml from 'js-yaml';
|
||||
import { Request, Response } from 'express';
|
||||
import { themes } from '../data/themes.js';
|
||||
import { loadTranslations } from "../util/translationHelper.js";
|
||||
import { FALLBACK_LANG } from '../config.js';
|
||||
import { getLogger, Logger } from '../logging/initalize.js';
|
||||
|
||||
const logger: Logger = getLogger();
|
||||
|
||||
interface Translations {
|
||||
curricula_page: {
|
||||
[key: string]: { title: string; description?: string }; // Optioneel veld description
|
||||
[key: string]: { title: string; description?: string };
|
||||
};
|
||||
}
|
||||
|
||||
function loadTranslations(language: string): Translations {
|
||||
try {
|
||||
const filePath = path.join(process.cwd(), '_i18n', `${language}.yml`);
|
||||
const yamlFile = fs.readFileSync(filePath, 'utf8');
|
||||
return yaml.load(yamlFile) as Translations;
|
||||
} catch (error) {
|
||||
logger.error(
|
||||
`Cannot load translation for: ${language}, fallen back to Dutch`
|
||||
);
|
||||
logger.error(error);
|
||||
const fallbackPath = path.join(process.cwd(), '_i18n', 'nl.yml');
|
||||
return yaml.load(fs.readFileSync(fallbackPath, 'utf8')) as Translations;
|
||||
}
|
||||
}
|
||||
|
||||
export function getThemes(req: Request, res: Response) {
|
||||
const language =
|
||||
(req.query.language as string)?.toLowerCase() || FALLBACK_LANG;
|
||||
const translations = loadTranslations(language);
|
||||
|
||||
const language = (req.query.language as string)?.toLowerCase() || 'nl';
|
||||
const translations = loadTranslations<Translations>(language);
|
||||
const themeList = themes.map((theme) => {
|
||||
return {
|
||||
key: theme.title,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core';
|
||||
import { Question } from './question.entity';
|
||||
import { Teacher } from '../users/teacher.entity';
|
||||
import { Question } from './question.entity.js';
|
||||
import { Teacher } from '../users/teacher.entity.js';
|
||||
|
||||
@Entity()
|
||||
export class Answer {
|
||||
|
|
|
@ -5,8 +5,33 @@ import { SqliteDriver } from '@mikro-orm/sqlite';
|
|||
import { MikroOrmLogger } from './logging/mikroOrmLogger.js';
|
||||
import { LOG_LEVEL } from './config.js';
|
||||
|
||||
const entities = ['dist/**/*.entity.js'];
|
||||
const entitiesTs = ['src/**/*.entity.ts'];
|
||||
// Import alle entity-bestanden handmatig
|
||||
import { User } from './entities/users/user.entity.js';
|
||||
import { Student } from './entities/users/student.entity.js';
|
||||
import { Teacher } from './entities/users/teacher.entity.js';
|
||||
|
||||
import { Assignment } from './entities/assignments/assignment.entity.js';
|
||||
import { Group } from './entities/assignments/group.entity.js';
|
||||
import { Submission } from './entities/assignments/submission.entity.js';
|
||||
|
||||
import { Class } from './entities/classes/class.entity.js';
|
||||
import { ClassJoinRequest } from './entities/classes/class-join-request.entity.js';
|
||||
import { TeacherInvitation } from './entities/classes/teacher-invitation.entity.js';
|
||||
|
||||
import { Attachment } from './entities/content/attachment.entity.js';
|
||||
import { LearningObject } from './entities/content/learning-object.entity.js';
|
||||
import { LearningPath } from './entities/content/learning-path.entity.js';
|
||||
|
||||
import { Answer } from './entities/questions/answer.entity.js';
|
||||
import { Question } from './entities/questions/question.entity.js';
|
||||
|
||||
const entities = [
|
||||
User, Student, Teacher,
|
||||
Assignment, Group, Submission,
|
||||
Class, ClassJoinRequest, TeacherInvitation,
|
||||
Attachment, LearningObject, LearningPath,
|
||||
Answer, Question
|
||||
];
|
||||
|
||||
function config(testingMode: boolean = false): Options {
|
||||
if (testingMode) {
|
||||
|
@ -14,7 +39,7 @@ function config(testingMode: boolean = false): Options {
|
|||
driver: SqliteDriver,
|
||||
dbName: getEnvVar(EnvVars.DbName),
|
||||
entities: entities,
|
||||
entitiesTs: entitiesTs,
|
||||
// entitiesTs: entitiesTs,
|
||||
|
||||
// Workaround: vitest: `TypeError: Unknown file extension ".ts"` (ERR_UNKNOWN_FILE_EXTENSION)
|
||||
// (see https://mikro-orm.io/docs/guide/project-setup#testing-the-endpoint)
|
||||
|
@ -32,7 +57,7 @@ function config(testingMode: boolean = false): Options {
|
|||
user: getEnvVar(EnvVars.DbUsername),
|
||||
password: getEnvVar(EnvVars.DbPassword),
|
||||
entities: entities,
|
||||
entitiesTs: entitiesTs,
|
||||
//entitiesTs: entitiesTs,
|
||||
|
||||
// Logging
|
||||
debug: LOG_LEVEL === 'debug',
|
||||
|
|
19
backend/src/util/translationHelper.ts
Normal file
19
backend/src/util/translationHelper.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import yaml from 'js-yaml';
|
||||
import {FALLBACK_LANG} from "../../config";
|
||||
|
||||
export function loadTranslations<T>(language: string): T {
|
||||
try {
|
||||
const filePath = path.join(process.cwd(), '_i18n', `${language}.yml`);
|
||||
const yamlFile = fs.readFileSync(filePath, 'utf8');
|
||||
return yaml.load(yamlFile) as T;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`Cannot load translation for ${language}, fallen back to dutch`
|
||||
);
|
||||
console.error(error);
|
||||
const fallbackPath = path.join(process.cwd(), '_i18n', `${FALLBACK_LANG}.yml`);
|
||||
return yaml.load(fs.readFileSync(fallbackPath, 'utf8')) as T;
|
||||
}
|
||||
}
|
BIN
frontend/public/assets/home/inclusive.png
Normal file
BIN
frontend/public/assets/home/inclusive.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 183 KiB |
BIN
frontend/public/assets/home/innovative.png
Normal file
BIN
frontend/public/assets/home/innovative.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 93 KiB |
BIN
frontend/public/assets/home/research_based.png
Normal file
BIN
frontend/public/assets/home/research_based.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
BIN
frontend/public/assets/home/socially_relevant.png
Normal file
BIN
frontend/public/assets/home/socially_relevant.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 85 KiB |
Loading…
Add table
Add a link
Reference in a new issue