Files
obsidian-livesync/src/modules/features/SetupWizard/dialogs/SelectMethodNewUser.svelte
T
ZeedifandClaude Opus 5 b6746be73e refactor(i18n): route remaining Obsidian UI text through the message catalogue
Continues the source-key migration inside the application boundary introduced
in 1.0.0, where LiveSync owns its catalogue and consumes Commonlib as a
published package.

- Replace hardcoded user-visible strings in the Obsidian UI (Setup Wizard
  dialogues, P2P panes, Customisation Sync panes, Global History, the JSON
  conflict pane and the remote-configuration menu) with `$msg` calls, keeping
  the English source string as the key.
- Wire up strings whose translations already existed in the catalogue but were
  still rendered as literals, for example the whole Intro dialogue.
- Add the new entries to `src/common/messagesYAML/en.yaml` and `es.yaml`, then
  regenerate `messagesJson/` and `combinedMessages.prod.ts` through the
  documented `i18n:bake` pipeline.
- No Commonlib gitlink or catalogue is involved; every change is
  LiveSync-owned.

Regenerating the catalogue also normalises three pre-existing entries each in
`ko.json` and `zh.json`, where the committed JSON kept a trailing space before
a newline that YAML cannot represent.

Verified with tsc-check, tsc-check:apps, svelte-check and lint.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 18:59:19 -06:00

65 lines
2.9 KiB
Svelte

<script lang="ts">
import DialogHeader from "@/modules/services/LiveSyncUI/components/DialogHeader.svelte";
import Guidance from "@/modules/services/LiveSyncUI/components/Guidance.svelte";
import Decision from "@/modules/services/LiveSyncUI/components/Decision.svelte";
import Question from "@/modules/services/LiveSyncUI/components/Question.svelte";
import Option from "@/modules/services/LiveSyncUI/components/Option.svelte";
import Options from "@/modules/services/LiveSyncUI/components/Options.svelte";
import Instruction from "@/modules/services/LiveSyncUI/components/Instruction.svelte";
import UserDecisions from "@/modules/services/LiveSyncUI/components/UserDecisions.svelte";
import { $msg as translateMessage } from "@/common/translation";
import {
TYPE_USE_SETUP_URI,
TYPE_CONFIGURE_MANUALLY,
TYPE_CANCELLED,
type SelectMethodNewUserResultType,
} from "./setupDialogTypes";
type Props = {
setResult: (result: SelectMethodNewUserResultType) => void;
};
const { setResult }: Props = $props();
let userType = $state<SelectMethodNewUserResultType>(TYPE_CANCELLED);
let proceedTitle = $derived.by(() => {
if (userType === TYPE_USE_SETUP_URI) {
return translateMessage("Proceed with Setup URI");
} else if (userType === TYPE_CONFIGURE_MANUALLY) {
return translateMessage("Ui.SetupWizard.SelectNew.ProceedManual");
} else {
return translateMessage("Please select an option to proceed");
}
});
const canProceed = $derived.by(() => {
return userType === TYPE_USE_SETUP_URI || userType === TYPE_CONFIGURE_MANUALLY;
});
</script>
<DialogHeader title={translateMessage("Connection Method")} />
<Guidance>{translateMessage("Ui.SetupWizard.SelectNew.Guidance")}</Guidance>
<Instruction>
<Question>{translateMessage("Ui.SetupWizard.SelectNew.Question")}</Question>
<Options>
<Option
selectedValue={TYPE_USE_SETUP_URI}
title={translateMessage("Use a Setup URI (Recommended)")}
bind:value={userType}
>
{translateMessage("Ui.SetupWizard.SelectNew.SetupUriOptionDesc")}
</Option>
<Option
selectedValue={TYPE_CONFIGURE_MANUALLY}
title={translateMessage("Ui.SetupWizard.SelectNew.ManualOption")}
bind:value={userType}
>
{translateMessage("Ui.SetupWizard.SelectNew.ManualOptionDesc")}
{translateMessage(
"P2P requires no central data-storage server, but it still uses a signalling relay for peer discovery."
)}
</Option>
</Options>
</Instruction>
<UserDecisions>
<Decision title={proceedTitle} important={canProceed} disabled={!canProceed} commit={() => setResult(userType)} />
<Decision title={translateMessage("Cancel")} commit={() => setResult(TYPE_CANCELLED)} />
</UserDecisions>