🌐 Integrated Chinese language

This commit is contained in:
Mawoka
2023-01-18 20:39:11 +01:00
parent 1f23d405e5
commit 6227238af1
2 changed files with 8 additions and 0 deletions
+2
View File
@@ -15,6 +15,7 @@ import ca from './locales/ca.json';
import it from './locales/it.json';
import es from './locales/es.json';
import nb_no from './locales/nb_NO.json';
import zh_Hant from './locales/zh_Hant.json';
import LanguageDetector from 'i18next-browser-languagedetector';
import type { i18n, Resource } from 'i18next';
@@ -68,6 +69,7 @@ export class I18nService {
this.i18n.addResourceBundle('ca', 'translation', ca);
this.i18n.addResourceBundle('es', 'translation', es);
this.i18n.addResourceBundle('nb_NO', 'translation', nb_no);
this.i18n.addResourceBundle('zh_Hant', 'translation', zh_Hant);
}
changeLanguage(language: string): void {
+6
View File
@@ -47,6 +47,7 @@
<script lang="ts">
import { onMount } from 'svelte';
import { browser } from '$app/environment';
import zh_Hant from '$lib/i18n/locales/zh_Hant.json';
export let languages: Array<{
flag: string;
@@ -97,6 +98,11 @@
code: 'nb_NO',
name: 'Norsk',
flag: '🇳🇴'
},
{
code: 'zh_Hant',
name: 'Chinese (traditional)',
flag: '🇨🇳'
}
];
const get_selected_language = (): string => {