Skip to content

fix(gui): support translator internal name in ENABLED_SERVICES config#1125

Open
octo-patch wants to merge 1 commit into
PDFMathTranslate:mainfrom
octo-patch:fix/issue-1108-enabled-services-translator-name
Open

fix(gui): support translator internal name in ENABLED_SERVICES config#1125
octo-patch wants to merge 1 commit into
PDFMathTranslate:mainfrom
octo-patch:fix/issue-1108-enabled-services-translator-name

Conversation

@octo-patch
Copy link
Copy Markdown
Contributor

Fixes #1108

Problem

When configuring ENABLED_SERVICES in the config file, users must use the UI display name (e.g. "Ali Qwen-Translation") to enable a service. However, translators also have an internal name attribute (e.g. "qwen-mt" for QwenMtTranslator), which is the name used in the translators list of the config file. This mismatch is confusing — users naturally try using the same name ("qwen-mt") in both ENABLED_SERVICES and translators, but only the translators lookup works with the internal name.

Solution

Extend the ENABLED_SERVICES filter in gui.py to match services by either their display name (the service_map key) or their translator internal name attribute. This way both of the following configs work:

// Using display name
"ENABLED_SERVICES": ["Ali Qwen-Translation"]

// Using internal translator name (now also supported)
"ENABLED_SERVICES": ["qwen-mt"]

Testing

  • Verified with a quick logic test that "qwen-mt" now resolves to "Ali Qwen-Translation" in the service list
  • Verified backward compatibility: existing configs using display names continue to work

Allow ENABLED_SERVICES to match services by their internal translator
name (e.g. "qwen-mt") in addition to their display name (e.g.
"Ali Qwen-Translation"), so users can use either form in the config.

Fixes PDFMathTranslate#1108
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.

Ali Qwen-Translation 配置错误

1 participant