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

@ -33,16 +33,16 @@
// TODO: make `server` a key/value pair to support multiple servers
server.set(await createServer(data.server_host));
if (!$server) {
error = `Failed to connect to <code>${data.server_host}</code>.`;
console.error(`Failed to connect to ${data.server_host}.`);
error = lang.string('error.connection_failed', data.server_host);
console.error(lang.string('logs.connection_failed', data.server_host));
return;
}
}
const post_data = await api.getPost($server.host, token, post_id);
if (!post_data || post_data.error) {
error = `Failed to retrieve post <code>${post_id}</code>.`;
console.error(`Failed to retrieve post ${post_id}.`);
error = lang.string('error.post_fetch_failed', post_id);
console.error(lang.string('logs.post_fetch_failed', post_id));
return;
}
let post = await parsePost(post_data, 0);
@ -83,9 +83,9 @@
<Button centered on:click={() => {goto(previous_page)}}>{lang.string('navigation.back')}</Button>
</nav>
{/if}
<img src={post.account.avatar_url} type={post.account.avatar_type || "image/png"} alt="" width="40" height="40" class="header-avatar" loading="lazy" decoding="async">
<img src={post.account.avatar_url} type={post.account.avatar_type || 'image/png'} alt="" width="40" height="40" class="header-avatar" loading="lazy" decoding="async">
<h1>
{@html lang.string('post.by').replaceAll('%1', post.account.rich_name)}
{@html lang.string('post.by', post.account.rich_name)}
</h1>
</header>