Send the remaining interface text through the catalog and audit it
Phase 4f. - scripts/i18nAudit.mjs runs in pnpm check. It fails for a key that the catalog does not have, a catalog key that the code does not use, and a row without all four languages. - message() marks a key that a variable carries to the translation call later: table formats, formula errors, and browser status messages. - 53 new rows with French, Japanese, and Simplified Chinese text for the status and error messages of the workbench, the tree, Settings, theme import, images, the built-in browser, and code blocks. The backlinks toggle now translates too. - 13 unused rows are gone. - Errors of the plugin API stay in English. docs/development.md has the rule in "Interface text". pnpm check, pnpm test (350 of 350), and the full smoke suite pass, except two tests that failed one time under load and passed on retry and 3 of 3 times alone.
This commit is contained in:
@@ -261,7 +261,7 @@
|
||||
oncompositionend={event => { composing = false; if (event.data) void orderedInput('insertText', { text: event.data }); textInput.value = ''; }}
|
||||
oninput={() => { if (!composing && textInput.value) { void orderedInput('insertText', { text: textInput.value }); textInput.value = ''; } }}
|
||||
onblur={stopScroll}></textarea>
|
||||
{#if image && ready && !blank}<img src={image} alt="Web page rendered by the browser" draggable="false" onload={acknowledgeFrame} onerror={acknowledgeFrame}>{/if}
|
||||
{#if image && ready && !blank}<img src={image} alt={$t("Web page rendered by the browser")} draggable="false" onload={acknowledgeFrame} onerror={acknowledgeFrame}>{/if}
|
||||
{#if scrollAnchor}<span class="scroll-anchor" style:left={`${scrollAnchor.x}px`} style:top={`${scrollAnchor.y}px`} aria-hidden="true">↕</span>{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
{#if busy}<p role="status">{$t("Please wait…")}</p>{/if}
|
||||
<div class="entries" aria-busy={busy}>
|
||||
{#if kind === 'cookies'}
|
||||
{#each cookies as cookie (cookie.id)}<div class="entry"><div><strong>{cookie.name || '(unnamed cookie)'}</strong><small>{cookie.domain} · {cookie.path}</small></div><button disabled={busy} aria-label={$t("Remove cookie {name} from {domain} at {path}", { name: cookie.name, domain: cookie.domain, path: cookie.path })} onclick={() => void remove('removeCookie', cookie.id)}><Icon icon="trash" />{$t("Remove")}</button></div>{/each}
|
||||
{#each cookies as cookie (cookie.id)}<div class="entry"><div><strong>{cookie.name || $t("(unnamed cookie)")}</strong><small>{cookie.domain} · {cookie.path}</small></div><button disabled={busy} aria-label={$t("Remove cookie {name} from {domain} at {path}", { name: cookie.name, domain: cookie.domain, path: cookie.path })} onclick={() => void remove('removeCookie', cookie.id)}><Icon icon="trash" />{$t("Remove")}</button></div>{/each}
|
||||
{#if data && !cookies.length}<p>{$t("No matching cookies.")}</p>{/if}
|
||||
{:else}
|
||||
{#each history as visit (visit.id)}<div class="entry"><div><strong>{visit.title || visit.url}</strong><small>{visit.url}</small><small>{new Date(visit.at).toLocaleString()}</small></div><button disabled={busy} aria-label={$t("Remove history entry {name}", { name: visit.title || visit.url })} onclick={() => void remove('removeHistory', visit.id)}><Icon icon="trash" />{$t("Remove")}</button></div>{/each}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { tr } from "../i18n/index.ts";
|
||||
import { mount, unmount } from 'svelte';
|
||||
import { get } from 'svelte/store';
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
@@ -60,13 +61,13 @@ export async function activate(api: PluginApi) {
|
||||
const web = ready && /^https?:\/\//.test(current?.url || '');
|
||||
return [
|
||||
{ separator: true },
|
||||
{ label: 'Move to new window', icon: 'external', disabled: !ready, run: () => run('moveToWindow', { pinned }) },
|
||||
{ label: 'Split right', icon: 'split-right', disabled: !ready, run: () => split('right') },
|
||||
{ label: 'Split down', icon: 'split-down', disabled: !ready, run: () => split('down') },
|
||||
{ label: tr("Move to new window"), icon: 'external', disabled: !ready, run: () => run('moveToWindow', { pinned }) },
|
||||
{ label: tr("Split right"), icon: 'split-right', disabled: !ready, run: () => split('right') },
|
||||
{ label: tr("Split down"), icon: 'split-down', disabled: !ready, run: () => split('down') },
|
||||
{ separator: true },
|
||||
{ label: 'Find…', icon: 'search', shortcut: 'Ctrl+F', disabled: !ready, run: () => { api.openView(id); void saved.control?.find(); } },
|
||||
{ label: 'Open in default browser', icon: 'external', disabled: !web, run: () => run('openExternal') },
|
||||
{ label: 'Bookmark', icon: 'bookmark', disabled: !web, run: () => run('bookmark') },
|
||||
{ label: tr("Find…"), icon: 'search', shortcut: 'Ctrl+F', disabled: !ready, run: () => { api.openView(id); void saved.control?.find(); } },
|
||||
{ label: tr("Open in default browser"), icon: 'external', disabled: !web, run: () => run('openExternal') },
|
||||
{ label: tr("Bookmark"), icon: 'bookmark', disabled: !web, run: () => run('bookmark') },
|
||||
];
|
||||
}, mount: container => {
|
||||
let runtimeId = '';
|
||||
@@ -106,12 +107,12 @@ export async function activate(api: PluginApi) {
|
||||
});
|
||||
api.registerTabDrop?.(async data => {
|
||||
const payload = JSON.parse(data);
|
||||
if (!payload || typeof payload.tabId !== 'string' || typeof payload.transferToken !== 'string') throw new Error('Invalid browser tab transfer.');
|
||||
if (!payload || typeof payload.tabId !== 'string' || typeof payload.transferToken !== 'string') throw new Error(tr("Invalid browser tab transfer."));
|
||||
const existing = owners.get(payload.tabId);
|
||||
if (existing) { api.openView(existing.view); return; }
|
||||
const snapshot = await request('adoptTab', { tabId: payload.tabId, transferToken: payload.transferToken });
|
||||
const current = snapshot.tabs.find(tab => tab.id === payload.tabId);
|
||||
if (!current) throw new Error('The browser tab is unavailable.');
|
||||
if (!current) throw new Error(tr("The browser tab is unavailable."));
|
||||
await open(current.profileId, current.url, undefined, current.id, payload.pinned === true);
|
||||
});
|
||||
const incoming = new URLSearchParams(location.search).get('browserTab');
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { message, tr } from "../i18n/index.ts";
|
||||
import type { Snapshot } from './client';
|
||||
|
||||
type Transport = (command: string, args?: Record<string, unknown>) => Promise<unknown>;
|
||||
@@ -32,9 +33,9 @@ export class TabSession {
|
||||
}
|
||||
}
|
||||
private failure(operation: string, error: unknown, tabId = this.value.tabId, phase: 'ready' | 'disconnected' = 'disconnected') {
|
||||
this.update({ phase, message: phase === 'ready' ? 'The browser could not complete this request. Check the error details.' : connectionLost(error)
|
||||
? 'This tab lost its browser connection. Select Reconnect to restore the page.'
|
||||
: 'The browser could not complete this request. Check the details, then select Reconnect.',
|
||||
this.update({ phase, message: phase === 'ready' ? message('The browser could not complete this request. Check the error details.') : connectionLost(error)
|
||||
? message('This tab lost its browser connection. Select Reconnect to restore the page.')
|
||||
: message('The browser could not complete this request. Check the details, then select Reconnect.'),
|
||||
detail: { operation, reason: String(error), tabId, time: new Date().toISOString() } });
|
||||
}
|
||||
connect(): Promise<void> {
|
||||
@@ -44,7 +45,7 @@ export class TabSession {
|
||||
return this.pending;
|
||||
}
|
||||
private async restore() {
|
||||
this.update({ phase: 'connecting', message: this.value.tabId ? 'Reconnecting browser…' : 'Opening browser…' });
|
||||
this.update({ phase: 'connecting', message: this.value.tabId ? message('Reconnecting browser…') : message('Opening browser…') });
|
||||
let operation = 'state';
|
||||
// The host discards a failed transport before the next request.
|
||||
for (let attempt = 0; attempt < 2; attempt++) {
|
||||
@@ -66,7 +67,7 @@ export class TabSession {
|
||||
if (current.tabs.some(tab => tab.id === result.tabId)) {
|
||||
this.observe(current); this.update({ phase: 'ready', message: '' }); return;
|
||||
}
|
||||
if (attempt === 1) throw new Error('The runtime restarted twice while opening this tab.');
|
||||
if (attempt === 1) throw new Error(tr("The runtime restarted twice while opening this tab."));
|
||||
} catch (error) {
|
||||
if (this.closed) return;
|
||||
if (attempt === 0 && connectionLost(error)) continue;
|
||||
|
||||
Reference in New Issue
Block a user