From 2511df1059a89f7aaf3ff6893c2466ab2da8ed8c Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Thu, 24 Sep 2026 18:52:31 +0200 Subject: [PATCH] fix: translate the plain text font, message spacing and read receipt settings --- .../__tests__/settings-i18n.test.ts | 22 +++++++++++++++++++ src/components/settings/ReadingSettings.tsx | 22 +++++++++---------- 2 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 src/components/__tests__/settings-i18n.test.ts diff --git a/src/components/__tests__/settings-i18n.test.ts b/src/components/__tests__/settings-i18n.test.ts new file mode 100644 index 00000000..0141881a --- /dev/null +++ b/src/components/__tests__/settings-i18n.test.ts @@ -0,0 +1,22 @@ +// Settings panes whose every user-visible string goes through t(). A literal +// English label, description or option label sneaking back in stays English +// in every locale, so this scans the source for the prop shapes the panes use. +import { describe, it, expect } from 'vitest'; +import { readFileSync } from 'node:fs'; +import { join } from 'node:path'; + +const TRANSLATED_PANES = ['ReadingSettings.tsx']; + +// `label="Foo"`, `description='Foo'`, `placeholder="Foo"` and `{ label: 'Foo' }` +// with a letter in the text (numeric option labels such as '25' are fine). +const LITERAL_RE = /\b(label|description|title|placeholder)(=|:\s*)(["'`])[^"'`]*[A-Za-z][^"'`]*\3/g; + +describe('translated settings panes', () => { + for (const file of TRANSLATED_PANES) { + it(`${file} has no hard-coded English labels`, () => { + const source = readFileSync(join(__dirname, '..', 'settings', file), 'utf8'); + const literals = [...source.matchAll(LITERAL_RE)].map((m) => m[0]); + expect(literals).toEqual([]); + }); + } +}); diff --git a/src/components/settings/ReadingSettings.tsx b/src/components/settings/ReadingSettings.tsx index ccc712e0..20b50a87 100644 --- a/src/components/settings/ReadingSettings.tsx +++ b/src/components/settings/ReadingSettings.tsx @@ -291,37 +291,37 @@ export function ReadingSettings() { /> - + update('messageSpacing', v as MessageSpacing)} options={[ - { value: 'auto', label: 'Automatic' }, - { value: 'always', label: 'Always padded' }, - { value: 'edge', label: 'Edge to edge' }, + { value: 'auto', label: t('settings.email_behavior.message_spacing.auto', "Auto (recommended)") }, + { value: 'always', label: t('settings.email_behavior.message_spacing.always', "Always add spacing") }, + { value: 'edge', label: t('settings.email_behavior.message_spacing.edge', "Edge to edge") }, ]} /> - +