fix: locales
This commit is contained in:
22
src/routes/settings/_Language.svelte
Normal file
22
src/routes/settings/_Language.svelte
Normal file
@@ -0,0 +1,22 @@
|
||||
<script>
|
||||
import { t } from '$lib/translations';
|
||||
import Cookies from 'js-cookie';
|
||||
import langs from '$lib/lang.json';
|
||||
function setLocale(locale) {
|
||||
Cookies.set('lang', locale);
|
||||
return window.location.reload();
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="grid grid-cols-2 items-start pb-4">
|
||||
<div class="flex-col">
|
||||
<div class="text-base font-bold text-stone-100">
|
||||
{$t('setting.change_language')}
|
||||
</div>
|
||||
</div>
|
||||
<div class="items-center justify-start space-x-2 text-left">
|
||||
{#each Object.entries(langs) as [lang, name]}
|
||||
<button on:click={() => setLocale(lang)}>Change to {name}</button>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
@@ -8,7 +8,7 @@ import { promises as dns } from 'dns';
|
||||
export const get: RequestHandler = async (event) => {
|
||||
const { teamId, status, body } = await getUserDetails(event);
|
||||
if (status === 401) return { status, body };
|
||||
if (teamId !== '0') return { status: 401, body: { message: 'You are not an admin.' } };
|
||||
if (teamId !== '0') return { status: 200, body: { settings: {} } };
|
||||
try {
|
||||
const settings = await listSettings();
|
||||
return {
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
import { session } from '$app/stores';
|
||||
|
||||
export let settings;
|
||||
import Cookies from 'js-cookie';
|
||||
import langs from '$lib/lang.json';
|
||||
import Setting from '$lib/components/Setting.svelte';
|
||||
import Explainer from '$lib/components/Explainer.svelte';
|
||||
import { errorNotification } from '$lib/form';
|
||||
@@ -38,6 +40,8 @@
|
||||
import { toast } from '@zerodevx/svelte-toast';
|
||||
import { t } from '$lib/translations';
|
||||
|
||||
import Language from './_Language.svelte';
|
||||
|
||||
let isRegistrationEnabled = settings.isRegistrationEnabled;
|
||||
let dualCerts = settings.dualCerts;
|
||||
|
||||
@@ -125,6 +129,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
<div class="grid grid-flow-row gap-2 px-10">
|
||||
<Language />
|
||||
<div class="grid grid-cols-2 items-start">
|
||||
<div class="flex-col">
|
||||
<div class="pt-2 text-base font-bold text-stone-100">
|
||||
@@ -226,4 +231,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="mx-auto max-w-4xl px-6">
|
||||
<Language />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user