Skip to content

feat: add Swiss German spelling option (ß → ss) to dictation settings#152

Open
Nico-123456 wants to merge 8 commits into
amicalhq:mainfrom
Nico-123456:swiss-german-spelling
Open

feat: add Swiss German spelling option (ß → ss) to dictation settings#152
Nico-123456 wants to merge 8 commits into
amicalhq:mainfrom
Nico-123456:swiss-german-spelling

Conversation

@Nico-123456

@Nico-123456 Nico-123456 commented Jun 5, 2026

Copy link
Copy Markdown

Why

Swiss Standard German (Switzerland and Liechtenstein) does not use the sharp s at all — every ß is written ss (Strasse, gross, weiss). Today there is no way to get Swiss spelling out of Amical:

  • The speech and formatting models emit standard German orthography with ß.
  • Vocabulary replacements can't fix it: they match whole words only (word-boundary regex in applyTextReplacements), and ß only ever appears inside a word, so a ß → ss replacement entry never fires. Adding every inflected ß word as a separate replacement doesn't scale.

What

A new toggle in Settings → Dictation (Languages section): Swiss German spelling (ß → ss). Off by default.

When enabled, ß/ are replaced with ss/SS as a character-level post-processing pass:

  • runs after AI formatting, because the language model may (re)introduce ß
  • runs before vocabulary replacements, so user replacements match the normalized text

Implementation notes

  • applySwissGermanSpelling() in utils/text-replacement.ts, applied in applyFormattingAndReplacements (covers both finalizeSession and retryTranscription)
  • New optional dictation.swissGermanSpelling setting (defaults to false everywhere it's read, so no settings migration is needed)
  • Threaded through DictationSettingsSchema (tRPC) and SharedPipelineData.userPreferences
  • Toggle UI in LanguageSettings.tsx, strings added for en/de/es/ja/zh-TW
  • Unit tests for the new function in tests/utils/text-replacement.test.ts

Testing

  • vitest: all 30 tests in text-replacement.test.ts pass (25 existing + 5 new)
  • Locale JSON validated, new hunks are prettier-clean
  • Not verified: full app build / manual UI test (toggle rendering in the Languages card should be double-checked)

Summary by CodeRabbit

Release Notes

  • New Features

    • Added Swiss German spelling option for dictation settings. When enabled, the German sharp s character (ß) is automatically replaced with "ss" during transcription to conform to Swiss Standard German conventions.
  • Localization

    • Added translations for the new Swiss German spelling feature in German, English, Spanish, Japanese, and Traditional Chinese.

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3a3633df-f481-4f3c-94ff-9a26e74bf2e0

📥 Commits

Reviewing files that changed from the base of the PR and between 979bf76 and a0627c5.

📒 Files selected for processing (13)
  • apps/desktop/src/db/app-settings.ts
  • apps/desktop/src/db/schema.ts
  • apps/desktop/src/i18n/locales/de.json
  • apps/desktop/src/i18n/locales/en.json
  • apps/desktop/src/i18n/locales/es.json
  • apps/desktop/src/i18n/locales/ja.json
  • apps/desktop/src/i18n/locales/zh-TW.json
  • apps/desktop/src/pipeline/core/context.ts
  • apps/desktop/src/renderer/main/pages/settings/dictation/components/LanguageSettings.tsx
  • apps/desktop/src/services/transcription-service.ts
  • apps/desktop/src/trpc/routers/settings.ts
  • apps/desktop/src/utils/text-replacement.ts
  • apps/desktop/tests/utils/text-replacement.test.ts

📝 Walkthrough

Walkthrough

This PR adds Swiss German spelling support to the transcription dictation feature, allowing users to enable automatic replacement of the German sharp s character (ß) with double-s (ss) and its capital form (ẞ) with SS. The change flows from database schema through settings storage, API endpoints, transcription processing, user interface, and localization across five languages.

Changes

Swiss German spelling dictation option

Layer / File(s) Summary
Schema and data model
apps/desktop/src/db/schema.ts, apps/desktop/src/db/app-settings.ts, apps/desktop/src/pipeline/core/context.ts
Database schema AppSettingsData and default settings constant extended with swissGermanSpelling boolean; pipeline context SharedPipelineData.userPreferences initialized with the flag set to false.
Text replacement utility and tests
apps/desktop/src/utils/text-replacement.ts, apps/desktop/tests/utils/text-replacement.test.ts
New exported applySwissGermanSpelling function performs Unicode-aware replacement of ß→ss and ẞ→SS; test suite validates handling of single/multiple occurrences, text without sharp s, and empty input.
Settings API schema and endpoints
apps/desktop/src/trpc/routers/settings.ts
DictationSettingsSchema adds swissGermanSpelling boolean field; getDictationSettings includes the flag in error-path defaults; setDictationSettings persists the flag from client input.
Transcription service integration
apps/desktop/src/services/transcription-service.ts
Service imports and applies applySwissGermanSpelling in the formatting pipeline; reads user preference from settings into context; threads the flag through both finalizeSession and retryTranscription paths; applies orthography normalization before vocabulary replacements.
Settings UI component
apps/desktop/src/renderer/main/pages/settings/dictation/components/LanguageSettings.tsx
LanguageSettings component adds swissGerman state bound to fetched settings; implements handleSwissGermanChange handler with optimistic update and rollback on failure; renders dedicated UI row with a Switch toggle disabled during mutation/query operations.
Internationalization labels
apps/desktop/src/i18n/locales/en.json, de.json, es.json, ja.json, zh-TW.json
New swissGerman language option entries (label and description) added to dictation language selection under settings.dictation.language.languages across all five supported locales.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • haritabh-z01

Poem

🐰 A German ß becomes an ss so neat,
Swiss spelling now makes dictation complete!
From schema to service, through UI so bright,
Five languages glowing—what a delightful sight! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main feature added in the changeset: a Swiss German spelling option for dictation settings that replaces ß with ss.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant