add i18n for console logs

This commit is contained in:
ari melody 2025-07-13 20:44:54 +01:00
parent b170a532f6
commit 7752585488
Signed by: ari
GPG key ID: CF99829C92678188
14 changed files with 77 additions and 31 deletions

View file

@ -8,17 +8,20 @@
import { error } from '@sveltejs/kit';
import { unread_notif_count, last_read_notif_id } from '$lib/notifications.js';
import { account } from '$lib/stores/account.js';
import Lang from '$lib/lang';
export let data;
const lang = Lang('en_GB');
let auth_code = data.code;
if (!auth_code || !get(server) || !get(app)) {
error(400, { message: "Bad request" });
error(400, { message: lang.string('error.bad_request') });
} else {
api.getToken(get(server).host, get(app).id, get(app).secret, auth_code).then(token => {
if (!token) {
error(400, { message: "Invalid auth code provided" });
error(400, { message: lang.string('error.invalid_auth_code') });
}
app.update(app => {
@ -30,7 +33,7 @@
if (!data) return goto("/");
account.set(parseAccount(data));
console.log(`Logged in as ${get(account).fqn}`);
console.log(lang.string('logs.logged_in', get(account).fqn));
// spin up async task to fetch notifications
return api.getNotifications(