feat(settings): mother-tongue language routing table
Replace the single reverse-direction pair with a general routing table. The saved target is the mother tongue and the default target for every source; languageRoutes is an empty-by-default, source-unique list of source-to-target rules (for example Chinese -> English, Traditional Chinese -> English, German -> English). Rules apply only when the source is confidently detected; otherwise the mother tongue is used. Same-language rules are dropped.\n\nThe panel shows the effective direction and a banner explaining a rule, with a one-capture override back to the mother tongue; the panel picker is now a session-only override. Persistent rules are edited in Settings. The old autoSwitchTarget/fallbackTargetLanguage keys are ignored, so the default after migration is everything -> mother tongue.\n\nAdd LanguageRoute, generalize the direction policy and tests, add the rules UI, and update ADR-022, architecture, translation output, user guide, README and progress. Verified: make verify green; empty rules translate French -> German, a Chinese -> English rule produces Chinese (Simplified) -> English with the banner, and the rules table renders in Settings.
This commit is contained in:
1 parent
41f1cea769
commit
940abcc996
24 files changed
+454
-336
No files matched your search
@@ -74,7 +74,7 @@ struct SettingsView: View {
|
||||
private var generalTab: some View {
|
||||
Form {
|
||||
Section(String(localized: "Translation")) {
|
||||
LabeledContent(String(localized: "Target language")) {
|
||||
LabeledContent(String(localized: "Mother tongue")) {
|
||||
Button {
|
||||
showLanguagePicker.toggle()
|
||||
} label: {
|
||||
@@ -93,8 +93,11 @@ struct SettingsView: View {
|
||||
recent: draft.recentTargets
|
||||
)
|
||||
}
|
||||
.accessibilityLabel(String(localized: "Target language"))
|
||||
.accessibilityLabel(String(localized: "Mother tongue"))
|
||||
}
|
||||
Text(String(localized: "The default target for every language unless a rule matches."))
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
Toggle(String(localized: "Show source preview"), isOn: $draft.showSourcePreview)
|
||||
Stepper(value: $draft.translationFontSize, in: 12 ... 28) {
|
||||
LabeledContent(
|
||||
@@ -123,11 +126,7 @@ struct SettingsView: View {
|
||||
)
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
FallbackTargetSettings(
|
||||
autoSwitchTarget: $draft.autoSwitchTarget,
|
||||
fallbackTargetLanguage: $draft.fallbackTargetLanguage,
|
||||
targetLanguage: draft.targetLanguage, recentTargets: draft.recentTargets
|
||||
)
|
||||
LanguageRulesSettings(routes: $draft.languageRoutes, motherTongue: draft.targetLanguageModel)
|
||||
}
|
||||
|
||||
Section(String(localized: "Double copy")) {
|
||||
|
||||
Reference in new issue
Block a user