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") }, ]} /> - +