Files
RuneStone/src/lib/layout/SettingsWindow.svelte
T
Knotty Wyvern e9c59f28de 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.
2026-10-28 12:00:24 -07:00

37 lines
1.5 KiB
Svelte

<script lang="ts">
import { t } from "$lib/i18n";
import { onMount } from "svelte";
import { isTauri } from "@tauri-apps/api/core";
import { getCurrentWindow } from "@tauri-apps/api/window";
import SettingsDialog from "./SettingsDialog.svelte";
import WindowControls from "$lib/ui/WindowControls.svelte";
import { onSettingsChange, takeSettingsNotice } from "$lib/settings/store";
import { DEFAULT_SETTINGS, readSettings, saveSettings, type AppSettings } from "$lib/workspace/settings";
let settings = $state<AppSettings>({ ...DEFAULT_SETTINGS });
let error = $state("");
function read() {
try { settings = readSettings(); }
catch { error = $t("Could not read your settings. Default settings apply until you save new settings."); }
}
onMount(() => {
read();
error = takeSettingsNotice() ?? error;
return onSettingsChange("general", read);
});
function save(next: AppSettings) {
const saved = saveSettings(next);
settings = { ...next };
error = "";
return saved;
}
async function close() {
if (!isTauri()) { window.location.assign("/"); return; }
try { await getCurrentWindow().close(); }
catch (reason) { error = $t("Could not close settings: {reason}", { reason: String(reason) }); }
}
</script>
{#snippet controls()}<WindowControls onError={message => error = message} />{/snippet}
<SettingsDialog {settings} standalone windowError={error} windowControls={isTauri() ? controls : undefined} onSave={save} onClose={() => void close()} />