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

@ -3,9 +3,12 @@ import { server } from '$lib/client/server.js';
import { app } from '$lib/client/app.js';
import { get, writable } from 'svelte/store';
import { parsePost } from '$lib/post.js';
import Lang from '$lib/lang';
export const timeline = writable([]);
const lang = Lang('en_GB');
let loading = false;
export async function getTimeline(clean) {
@ -24,7 +27,7 @@ export async function getTimeline(clean) {
);
if (!timeline_data) {
console.error(`Failed to retrieve timeline.`);
console.error(lang.string('logs.timeline_fetch_failed'));
loading = false;
return;
}
@ -37,10 +40,10 @@ export async function getTimeline(clean) {
if (!post) {
if (post === null || post === undefined) {
if (post_data.id) {
console.warn("Failed to parse post #" + post_data.id);
console.warn(lang.string('logs.post_parse_failed_id', post_data.id));
} else {
console.warn("Failed to parse post:");
console.warn(post_data);
console.warn(lang.string('logs.post_parse_failed'));
console.debug(post_data);
}
}
continue;