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

@ -1,6 +1,9 @@
import { server } from '$lib/client/server.js';
import { parseEmoji, renderEmoji } from '$lib/emoji.js';
import { get, writable } from 'svelte/store';
import Lang from '$lib/lang';
const lang = Lang('en_GB');
const cache = writable({});
@ -11,7 +14,7 @@ const cache = writable({});
*/
export function parseAccount(data) {
if (!data) {
console.error("Attempted to parse account data but no data was provided");
console.error(lang.string('logs.account_data_empty'));
return null;
}
let account = get(cache)[data.id];
@ -20,7 +23,7 @@ export function parseAccount(data) {
account = {};
account.id = data.id;
account.nickname = data.display_name.trim();
account.nickname = data.display_name.trim().replaceAll('<', '&lt;').replaceAll('>', '&gt;');
account.username = data.username;
account.name = account.nickname || account.username;
account.avatar_url = data.avatar;