add language switch, add german

This commit is contained in:
Manuel Ruwe
2022-08-24 17:58:14 +02:00
parent 6d0a31f79e
commit 4d757ccf66
44 changed files with 578 additions and 429 deletions

27
src/languages/language.ts Normal file
View File

@@ -0,0 +1,27 @@
export class Language {
shortName: string;
originalName: string;
translatedName: string;
constructor(shortName: string, originalName: string, translatedName: string) {
this.shortName = shortName;
this.originalName = originalName;
this.translatedName = translatedName;
}
}
const languages: Language[] = [
{
shortName: 'de',
originalName: 'Deutsch',
translatedName: 'German',
},
{
shortName: 'en',
originalName: 'English',
translatedName: 'English',
},
];
export const getLanguageByCode = (code: string | null) =>
languages.find((language) => language.shortName === code) ?? languages[-1];