diff --git a/ios/engine/KMEI/KeymanEngine/Classes/Settings/LanguageSettingsViewController.swift b/ios/engine/KMEI/KeymanEngine/Classes/Settings/LanguageSettingsViewController.swift index 1593c7d3b3..40968726cf 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/Settings/LanguageSettingsViewController.swift +++ b/ios/engine/KMEI/KeymanEngine/Classes/Settings/LanguageSettingsViewController.swift @@ -105,21 +105,26 @@ class LanguageSettingsViewController: UITableViewController { } } + func refreshSwitchVisibility() { + let userDefaults = Storage.active.userDefaults + + let mayCorrect = userDefaults.correctSettingForLanguage(languageID: self.language.id) + self.doCorrectionsSwitch?.isHidden = !mayCorrect + self.doCorrectionsLabel?.isEnabled = mayCorrect + + let mayAutoCorrect = userDefaults.autocorrectSettingForLanguage(languageID: self.language.id) + self.doAutocorrectionsSwitch?.isHidden = !(mayCorrect && mayAutoCorrect) + self.doAutocorrectionsLabel?.isEnabled = mayCorrect && mayAutoCorrect + self.correctionsCell?.isUserInteractionEnabled = mayCorrect + } + @objc func predictionSwitchValueChanged(source: UISwitch) { let value = source.isOn; let userDefaults = Storage.active.userDefaults userDefaults.set(predictSetting: value, forLanguageID: self.language.id) - // Reactively set the corrections switch interactivity state. - self.doCorrectionsSwitch?.isHidden = !value - self.doCorrectionsLabel?.isEnabled = value - - let mayCorrect = userDefaults.autocorrectSettingForLanguage(languageID: self.language.id) - self.doAutocorrectionsSwitch?.isHidden = !(value && mayCorrect) - self.doAutocorrectionsLabel?.isEnabled = value && mayCorrect - self.correctionsCell?.isUserInteractionEnabled = value - + refreshSwitchVisibility() refreshModelIfNeeded() } @@ -129,11 +134,7 @@ class LanguageSettingsViewController: UITableViewController { let userDefaults = Storage.active.userDefaults userDefaults.set(correctSetting: value, forLanguageID: self.language.id) - // This may only be triggered if the predict toggle is on, - // so we can rely on just the input value. - self.doAutocorrectionsSwitch?.isHidden = !value - self.doAutocorrectionsLabel?.isEnabled = value - + refreshSwitchVisibility() refreshModelIfNeeded() } diff --git a/ios/engine/KMEI/KeymanEngine/en.lproj/Localizable.strings b/ios/engine/KMEI/KeymanEngine/en.lproj/Localizable.strings index 0e5b70769b..e45e70f853 100644 --- a/ios/engine/KMEI/KeymanEngine/en.lproj/Localizable.strings +++ b/ios/engine/KMEI/KeymanEngine/en.lproj/Localizable.strings @@ -152,13 +152,13 @@ "menu-langsettings-title" = "%@ Settings"; /* Label for the toggle that enables corrections that is displayed within a language-specific settings menu */ -"menu-langsettings-toggle-correct" = "Enable corrections"; +"menu-langsettings-toggle-correct" = "Offer corrections"; /* Label for the toggle that enables auto-corrections that is displayed within a language-specific settings menu */ -"menu-langsettings-toggle-autocorrect" = "Enable autocorrections"; +"menu-langsettings-toggle-autocorrect" = "Apply corrections automatically"; /* Label for the toggle that enables predictions that is displayed within a language-specific settings menu */ -"menu-langsettings-toggle-predict" = "Enable predictions"; +"menu-langsettings-toggle-predict" = "Offer word completions"; /* Help message for a prompt that appears for confirming a lexical model download: language (1): lexical model (dictionary) name (2) */ "menu-lexical-model-install-message" = "Would you like to install this dictionary?";