Skip to content

feat(settings): support multiple auto query language exclusions - #1278

Open
yaobii-lab wants to merge 1 commit into
tisfeng:devfrom
yaobii-lab:feat/multi-language-query-icon-exclusions
Open

yaobii-lab wants to merge 1 commit into
tisfeng:devfrom
yaobii-lab:feat/multi-language-query-icon-exclusions

Conversation

@yaobii-lab

Copy link
Copy Markdown
Contributor

Summary

  • allow excluding multiple detected languages from the automatic query icon
  • replace the single-language picker with a checked language menu
  • migrate the existing single-language preference on upgrade
  • show a concise selection summary and make an empty selection allow all languages

Verification

  • git diff --check
  • parsed Localizable.xcstrings as JSON
  • static review of configuration migration, SwiftUI bindings, and event-monitor decision path

Not run locally

  • build
  • tests
  • app
  • formatter

自动查询图标原先只能排除一种文本语言,多语言使用者仍会在熟悉语言上频繁看到查询入口。

将排除配置迁移为语言集合,并在高级设置中提供带勾选状态的语言菜单;升级时保留旧的单选配置。

自动查询判断现在会跳过集合中的任意语言,空集合表示全部语言都允许显示图标。

----------------------------------------------------------------------

feat(settings): support multiple auto query language exclusions

The auto query icon could previously exclude only one text language, so multilingual users still saw the query entry for languages they already understood.

Migrate the exclusion setting to a language set and provide a checked language menu in Advanced settings while preserving the existing single-language value on upgrade.

The auto query decision now skips every language in the set, and an empty set allows the icon for all languages.
Copilot AI lite review requested due to automatic review settings August 21, 2026 01:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the “auto query icon” language exclusion setting from a single excluded language to a multi-select set, updates the Advanced settings UI accordingly, and adds a one-time migration path for existing users.

Changes:

  • Replace the single-language picker with a menu of checked languages and a concise selection summary (empty = allow all languages).
  • Switch configuration/storage from autoShowQueryIconExcludedLanguage: Language to autoShowQueryIconExcludedLanguages: Set<Language>.
  • Update the event-monitor decision path to honor multiple excluded languages and add a migration flag/key.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Easydict/Swift/View/SettingView/Tabs/TabView/AdvancedTab.swift Replaces the single-language picker with a multi-select menu and displays a summary/“All languages” label.
Easydict/Swift/Utility/EventMonitor/Core/EventMonitor.swift Updates auto-query icon gating logic to check membership in an excluded language set.
Easydict/Swift/Feature/Configuration/MyConfiguration.swift Migrates legacy single-language preference to the new set-based key and observes the new key for logging.
Easydict/Swift/Feature/Configuration/Defaults.Keys+Extension.swift Adds new Defaults keys for the excluded language set and a migration sentinel flag.
Easydict/App/Localizable.xcstrings Adds a localized string for the “All languages” (empty exclusion) summary label.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +433 to +435
fileprivate func didSetAutoShowQueryIconExcludedLanguages() {
logSettings(["auto_show_query_icon_excluded_languages": autoShowQueryIconExcludedLanguages.formattedDescription])
}
let shouldShowAutoQueryIcon = !excludedLanguages.contains(detectedLanguage)
logInfo(
"detected language: \(detectedLanguage), excluded language: \(excludedLanguage), shouldShowAutoQueryIcon: \(shouldShowAutoQueryIcon)"
"detected language: \(detectedLanguage), excluded languages: \(excludedLanguages.formattedDescription), shouldShowAutoQueryIcon: \(shouldShowAutoQueryIcon)"
Comment on lines 41 to 45
DispatchQueue.main.async { [weak self] in
guard let self else { return }
migrateAutoShowQueryIconExcludedLanguage()
observeKeys()
}

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8a7281a86d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +40 to +42
static let autoShowQueryIconExcludedLanguages = Key<Set<Language>>(
"EZConfiguration_kAutoShowQueryIconExcludedLanguagesKey", default: []
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update the required directory overviews and diagrams

This change modifies files in Feature/Configuration and Utility/EventMonitor/Core, which each contain multiple direct source files but no required Chinese HTML overview or companion SVG, and it changes TabView without updating its overview/diagram (the existing overview is Markdown rather than the required HTML). Add or update those artifacts in this change so the documented configuration and event-monitor flows remain synchronized.

AGENTS.md reference: AGENTS.md:L164-L178

Useful? React with 👍 / 👎.

Comment on lines +473 to +475
private var excludedLanguagesSummary: String {
guard !autoShowQueryIconExcludedLanguages.isEmpty else {
return String(localized: "setting.advance.auto_show_query_icon.condition.language.none")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Describe an empty exclusion selection as none

When the set is empty, the control displays “All languages” next to the existing label “Show only when selected text language is not,” which tells users that all languages are excluded even though EventMonitor treats the empty set as excluding nothing. Display a value such as “None,” or adjust the surrounding label so the empty state accurately communicates that the icon is allowed for every language.

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
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.

2 participants