Skip to content

Conversation

@mythic3011
Copy link

Summary

Add Translation Files:

  • Cantonese (yue)
  • Hong Kong Chinese (zh-HK)
  • Taiwan Chinese (zh-TW)

Add translation engines:

  • GitHub Models
  • OpenRouter
  • xAI (Grok)

Changes

  • 23 files changed, 3661 insertions(+), 47 deletions(-)
  • Added complete translation files with 256 strings each
  • Implemented 3 new LLM translation engines with proper error handling
  • Updated language utilities and UI components
  • Added Traditional Chinese (Taiwan) README documentation

mythic3011 and others added 9 commits February 7, 2026 23:08
- Create docs/README_zh-TW.md with full Traditional Chinese Taiwan translation
- Update all README files to include zh-TW language link
- Maintain consistency across all language versions
*Total -- 114.15kb -> 101.62kb (10.98%)

/resources/static/webtoon-toggle.svg -- 0.73kb -> 0.48kb (33.91%)
/resources/static/minus.svg -- 0.48kb -> 0.32kb (32.66%)
/resources/static/minus_line.svg -- 0.49kb -> 0.34kb (31.88%)
/resources/static/sphere.svg -- 0.52kb -> 0.36kb (30.21%)
/resources/static/filter_fill.svg -- 0.62kb -> 0.46kb (25.27%)
/resources/static/left_fill.svg -- 0.64kb -> 0.49kb (24.43%)
/resources/static/italic.svg -- 0.65kb -> 0.49kb (24.32%)
/resources/static/up_fill.svg -- 0.65kb -> 0.49kb (24.25%)
/resources/static/down_fill.svg -- 0.66kb -> 0.50kb (23.99%)
/resources/static/right_fill.svg -- 0.68kb -> 0.52kb (23.17%)
/resources/static/close_line.svg -- 0.69kb -> 0.53kb (22.93%)
/resources/static/close_line_dark.svg -- 0.69kb -> 0.53kb (22.51%)
/resources/static/alert_fill.svg -- 0.72kb -> 0.56kb (21.96%)
/resources/static/big_view.svg -- 0.72kb -> 0.56kb (21.96%)
/resources/static/loading.svg -- 0.73kb -> 0.57kb (21.52%)
/resources/static/more.svg -- 0.86kb -> 0.68kb (20.41%)
/resources/static/add_line.svg -- 0.81kb -> 0.65kb (20.38%)
/resources/static/folder_fill.svg -- 0.79kb -> 0.63kb (20.02%)
/resources/static/size_grip.svg -- 0.74kb -> 0.59kb (20%)
/resources/static/left_line.svg -- 0.79kb -> 0.64kb (19.8%)
/resources/static/edit_fill.svg -- 0.81kb -> 0.65kb (19.52%)
/resources/static/down_line.svg -- 0.81kb -> 0.65kb (19.44%)
/resources/static/left_line_dark.svg -- 0.79kb -> 0.64kb (19.43%)
/resources/static/right_line.svg -- 0.82kb -> 0.66kb (19.14%)
/resources/static/down_line_dark.svg -- 0.81kb -> 0.65kb (19.08%)
/resources/static/folder_line.svg -- 0.84kb -> 0.68kb (18.81%)
/resources/static/right_line_dark.svg -- 0.82kb -> 0.67kb (18.79%)
/resources/static/trash_fill.svg -- 0.87kb -> 0.71kb (18.03%)
/resources/static/up_line_dark.svg -- 0.86kb -> 0.70kb (17.97%)
/resources/static/home_fill.svg -- 0.89kb -> 0.73kb (17.69%)
/resources/static/save_fill.svg -- 0.87kb -> 0.72kb (17.1%)
/resources/static/media_fill.svg -- 0.93kb -> 0.77kb (16.97%)
/resources/static/alert_line.svg -- 0.93kb -> 0.77kb (16.95%)
/resources/static/upload_line.svg -- 0.88kb -> 0.74kb (16.78%)
/resources/static/check.svg -- 0.96kb -> 0.80kb (16.35%)
/resources/static/underline.svg -- 0.96kb -> 0.81kb (16.31%)
/resources/static/detail_line.svg -- 1.01kb -> 0.85kb (15.56%)
/resources/static/cloud_fill.svg -- 1.03kb -> 0.88kb (15.22%)
/resources/static/circle.svg -- 1.04kb -> 0.88kb (15.15%)
/resources/static/save_line.svg -- 1.01kb -> 0.87kb (14.64%)
/resources/static/search_line.svg -- 1.14kb -> 0.98kb (14.54%)
/resources/static/bold.svg -- 1.11kb -> 0.95kb (14.15%)
/resources/static/splitter.svg -- 1.15kb -> 0.99kb (13.67%)
/resources/static/warning_line.svg -- 1.29kb -> 1.11kb (13.6%)
/resources/static/success_fill.svg -- 1.17kb -> 1.01kb (13.43%)
/resources/static/splitter_dark.svg -- 1.15kb -> 1.00kb (13.41%)
/resources/static/float.svg -- 1.25kb -> 1.08kb (13.3%)
/resources/static/info_fill.svg -- 1.19kb -> 1.04kb (13.18%)
/resources/static/float_dark.svg -- 1.25kb -> 1.09kb (12.83%)
/resources/static/warning_fill.svg -- 1.28kb -> 1.12kb (12.31%)
/resources/static/media_line.svg -- 1.37kb -> 1.20kb (12.15%)
/resources/static/male.svg -- 1.35kb -> 1.19kb (11.65%)
/resources/static/error_line.svg -- 1.51kb -> 1.33kb (11.59%)
/resources/static/filter_line.svg -- 1.38kb -> 1.22kb (11.43%)
/resources/static/table_view.svg -- 1.51kb -> 1.35kb (10.97%)
/resources/static/cloud_line.svg -- 1.54kb -> 1.38kb (10.77%)
/resources/static/info_line.svg -- 1.54kb -> 1.38kb (10.75%)
/resources/static/confirm_line.svg -- 1.47kb -> 1.31kb (10.7%)
/resources/static/calendar_fill.svg -- 1.51kb -> 1.36kb (10.39%)
/resources/static/calendar_fill_dark.svg -- 1.51kb -> 1.36kb (10.19%)
/resources/static/error_fill.svg -- 1.59kb -> 1.44kb (9.86%)
/resources/static/refresh_line.svg -- 1.60kb -> 1.45kb (9.8%)
/resources/static/success_line.svg -- 1.71kb -> 1.54kb (9.7%)
/resources/static/female.svg -- 1.82kb -> 1.66kb (8.64%)
/resources/static/confirm_fill.svg -- 1.83kb -> 1.68kb (8.58%)
/resources/static/close_fill.svg -- 1.86kb -> 1.71kb (8.43%)
/resources/static/edit_line.svg -- 1.88kb -> 1.72kb (8.36%)
/resources/static/tree_view.svg -- 1.93kb -> 1.77kb (8.16%)
/resources/static/list_view.svg -- 2.68kb -> 2.48kb (7.5%)
/resources/static/trash_line.svg -- 2.16kb -> 2.00kb (7.29%)
/resources/static/attachment_line.svg -- 2.16kb -> 2.01kb (6.87%)
/resources/static/user_fill.svg -- 2.54kb -> 2.38kb (6.19%)
/resources/static/ct-file-icon.svg -- 0.59kb -> 0.55kb (6.14%)
/resources/static/calendar_line.svg -- 3.89kb -> 3.67kb (5.63%)
/resources/static/gridicons--create.svg -- 0.25kb -> 0.23kb (5.18%)
/resources/static/calendar_line_dark.svg -- 3.89kb -> 3.69kb (5.02%)
/resources/static/tabler--file-export.svg -- 0.31kb -> 0.30kb (5%)
/resources/static/home_line.svg -- 0.45kb -> 0.43kb (4.58%)
/resources/static/file-plus.svg -- 0.46kb -> 0.45kb (3.58%)
/resources/static/file.svg -- 0.42kb -> 0.40kb (3.53%)
/resources/static/ion--image-outline.svg -- 0.53kb -> 0.51kb (3.48%)
/resources/static/empty.svg -- 4.81kb -> 4.64kb (3.45%)
/resources/static/spliter.svg -- 0.92kb -> 0.89kb (3.41%)
/resources/static/user_line.svg -- 4.98kb -> 4.83kb (3.16%)
/resources/static/tabler--align-left.svg -- 0.22kb -> 0.21kb (3.14%)
/resources/static/folder-open.svg -- 0.48kb -> 0.47kb (2.83%)
/resources/static/mingcute--document-line.svg -- 0.82kb -> 0.80kb (1.91%)
/resources/static/eraser_fill.svg -- 0.36kb -> 0.35kb (1.91%)
/resources/static/flowbite--file-zip-outline.svg -- 0.43kb -> 0.43kb (1.58%)
/resources/static/tabler--align-center.svg -- 0.21kb -> 0.21kb (1.38%)
/resources/static/arrow-right.svg -- 0.21kb -> 0.21kb (1.36%)
/resources/static/arrow-left.svg -- 0.21kb -> 0.21kb (1.36%)
/resources/static/fluent--save-16-regular.svg -- 0.52kb -> 0.51kb (1.31%)
/resources/static/select.svg -- 0.25kb -> 0.25kb (1.18%)
/resources/static/upload-file.svg -- 0.26kb -> 0.26kb (1.11%)
/resources/static/save.svg -- 0.28kb -> 0.28kb (1.03%)
/resources/static/eraser.svg -- 0.29kb -> 0.29kb (1.01%)
/resources/static/save-all.svg -- 0.34kb -> 0.34kb (0.86%)
/resources/static/undo.svg -- 0.34kb -> 0.34kb (0.85%)
/resources/static/redo.svg -- 0.35kb -> 0.35kb (0.84%)
/resources/static/brush-fill.svg -- 0.37kb -> 0.36kb (0.8%)
/resources/static/fluent--save-as-24-regular.svg -- 0.88kb -> 0.88kb (0.78%)
/resources/static/mdi--comic-thought-bubble-outline.svg -- 1.00kb -> 0.99kb (0.69%)
/resources/static/replace.svg -- 0.45kb -> 0.45kb (0.65%)
/resources/static/pan_tool.svg -- 0.50kb -> 0.50kb (0.58%)
/resources/static/replace-all.svg -- 0.55kb -> 0.55kb (0.53%)
/resources/static/clear-outlined.svg -- 0.56kb -> 0.56kb (0.52%)
/resources/static/settings.svg -- 0.72kb -> 0.72kb (0.41%)

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>
- Add Cantonese (yue) language code to language_codes dictionary
- Add Hong Kong Chinese (zh-HK) language code to language_codes dictionary
- Add Taiwan Chinese (zh-TW) language code to language_codes dictionary
- Enable vertical layout support for zh-HK and yue in render.py
- Implement smart language code mapping system in load_translation()
- Map internal codes to translation file codes (yue → zh-HK)
- Improve get_system_language() to detect Chinese locales by region
- Add complete translation files for Hong Kong Chinese (256 strings)
- Add complete translation files for Taiwan Chinese (256 strings)
- Update translation engines (DeepL, Microsoft, Yandex) for new language codes
- Update translation factory for new language variants
- Update UI components to support new languages

New Languages Added:
- Cantonese (yue): Full UI localization with vertical text support
- Hong Kong Chinese (zh-HK): Complete translation with 256 strings
- Taiwan Chinese (zh-TW): Full localization support

Translation Files:
- resources/translations/ct-zh-HK.ts: 1521 lines, 256 translations
- resources/translations/compiled/ct_zh-HK.qm: 20K compiled file
- resources/translations/ct-zh-TW.ts: 1521 lines, 256 translations
- resources/translations/compiled/ct_zh-TW.qm: 20K compiled file
…dpoints

- Refactor github.py to use REST API instead of OpenAI SDK
- Fix GitHub Models API endpoint to correct Azure URL
- Refactor xai.py to inherit from BaseLLMTranslation directly
- Fix xAI API endpoint URL
- Fix OpenRouter API endpoint (was pointing to OpenAI)
- Add comprehensive error handling to all three engines
- Implement consistent _make_api_request method pattern
- Add proper type hints and docstrings
- Add MODEL_MAP fallback for all engines
- Remove tight coupling between xai and gpt implementations
[ImgBot] Optimize images
Copilot AI review requested due to automatic review settings February 8, 2026 10:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds additional Chinese language variants (Cantonese/HK/TW) and introduces new LLM-based translation backends (GitHub Models, OpenRouter, xAI), alongside assorted UI/language-selection updates and documentation tweaks.

Changes:

  • Added new LLM translation engines: GitHub Models, OpenRouter, and xAI (Grok).
  • Added/updated language mappings and vertical-rendering rules for Chinese variants.
  • Updated UI language options, docs links, and normalized many SVG assets.

Reviewed changes

Copilot reviewed 19 out of 131 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
resources/static/webtoon-toggle.svg Minified/normalized SVG formatting/colors.
resources/static/warning_line.svg Minified/normalized SVG formatting/colors.
resources/static/warning_fill.svg Minified/normalized SVG formatting/colors.
resources/static/upload_line.svg Minified/normalized SVG formatting/colors.
resources/static/upload-file.svg Minified/normalized SVG formatting/colors.
resources/static/up_line_dark.svg Minified/normalized SVG formatting/colors.
resources/static/up_fill.svg Minified/normalized SVG formatting/colors.
resources/static/undo.svg Minified/normalized SVG formatting/colors.
resources/static/underline.svg Minified/normalized SVG formatting/colors.
resources/static/tree_view.svg Minified/normalized SVG formatting/colors.
resources/static/trash_fill.svg Minified/normalized SVG formatting/colors.
resources/static/tabler--file-export.svg Minified/normalized SVG formatting/colors.
resources/static/tabler--align-left.svg Minified/normalized SVG formatting/colors.
resources/static/tabler--align-center.svg Minified/normalized SVG formatting/colors.
resources/static/table_view.svg Minified/normalized SVG formatting/colors.
resources/static/success_line.svg Minified/normalized SVG formatting/colors.
resources/static/success_fill.svg Minified/normalized SVG formatting/colors.
resources/static/splitter_dark.svg Minified/normalized SVG formatting/colors.
resources/static/splitter.svg Minified/normalized SVG formatting/colors.
resources/static/spliter.svg Minified/normalized SVG formatting/colors.
resources/static/sphere.svg Minified/normalized SVG formatting/colors.
resources/static/size_grip.svg Minified/normalized SVG formatting/colors.
resources/static/settings.svg Minified/normalized SVG formatting/colors.
resources/static/select.svg Minified/normalized SVG formatting/colors.
resources/static/search_line.svg Minified/normalized SVG formatting/colors.
resources/static/save_line.svg Minified/normalized SVG formatting/colors.
resources/static/save_fill.svg Minified/normalized SVG formatting/colors.
resources/static/save.svg Minified/normalized SVG formatting/colors.
resources/static/save-all.svg Minified/normalized SVG formatting/colors.
resources/static/right_line_dark.svg Minified/normalized SVG formatting/colors.
resources/static/right_line.svg Minified/normalized SVG formatting/colors.
resources/static/right_fill.svg Minified/normalized SVG formatting/colors.
resources/static/replace.svg Minified/normalized SVG formatting/colors.
resources/static/replace-all.svg Minified/normalized SVG formatting/colors.
resources/static/refresh_line.svg Minified/normalized SVG formatting/colors.
resources/static/redo.svg Minified/normalized SVG formatting/colors.
resources/static/pan_tool.svg Minified/normalized SVG formatting/colors.
resources/static/more.svg Minified/normalized SVG formatting/colors.
resources/static/minus_line.svg Minified/normalized SVG formatting/colors.
resources/static/minus.svg Minified/normalized SVG formatting/colors.
resources/static/mingcute--document-line.svg Minified/normalized SVG formatting/colors.
resources/static/media_line.svg Minified/normalized SVG formatting/colors.
resources/static/media_fill.svg Minified/normalized SVG formatting/colors.
resources/static/mdi--comic-thought-bubble-outline.svg Minified/normalized SVG formatting/colors.
resources/static/male.svg Minified/normalized SVG formatting/colors.
resources/static/loading.svg Minified/normalized SVG formatting/colors.
resources/static/left_line_dark.svg Minified/normalized SVG formatting/colors.
resources/static/left_line.svg Minified/normalized SVG formatting/colors.
resources/static/left_fill.svg Minified/normalized SVG formatting/colors.
resources/static/italic.svg Minified/normalized SVG formatting/colors.
resources/static/ion--image-outline.svg Minified/normalized SVG formatting/colors.
resources/static/info_line.svg Minified/normalized SVG formatting/colors.
resources/static/info_fill.svg Minified/normalized SVG formatting/colors.
resources/static/home_line.svg Minified/normalized SVG formatting/colors.
resources/static/home_fill.svg Minified/normalized SVG formatting/colors.
resources/static/gridicons--create.svg Minified/normalized SVG formatting/colors.
resources/static/folder_line.svg Minified/normalized SVG formatting/colors.
resources/static/folder_fill.svg Minified/normalized SVG formatting/colors.
resources/static/folder-open.svg Minified/normalized SVG formatting/colors.
resources/static/fluent--save-as-24-regular.svg Minified/normalized SVG formatting/colors.
resources/static/fluent--save-16-regular.svg Minified/normalized SVG formatting/colors.
resources/static/flowbite--file-zip-outline.svg Minified/normalized SVG formatting/colors.
resources/static/float_dark.svg Minified/normalized SVG formatting/colors.
resources/static/float.svg Minified/normalized SVG formatting/colors.
resources/static/filter_line.svg Minified/normalized SVG formatting/colors.
resources/static/filter_fill.svg Minified/normalized SVG formatting/colors.
resources/static/file.svg Minified/normalized SVG formatting/colors.
resources/static/file-plus.svg Minified/normalized SVG formatting/colors.
resources/static/female.svg Minified/normalized SVG formatting/colors.
resources/static/error_line.svg Minified/normalized SVG formatting/colors.
resources/static/error_fill.svg Minified/normalized SVG formatting/colors.
resources/static/eraser_fill.svg Minified/normalized SVG formatting/colors.
resources/static/eraser.svg Minified/normalized SVG formatting/colors.
resources/static/edit_line.svg Minified/normalized SVG formatting/colors.
resources/static/edit_fill.svg Minified/normalized SVG formatting/colors.
resources/static/down_line_dark.svg Minified/normalized SVG formatting/colors.
resources/static/down_line.svg Minified/normalized SVG formatting/colors.
resources/static/down_fill.svg Minified/normalized SVG formatting/colors.
resources/static/detail_line.svg Minified/normalized SVG formatting/colors.
resources/static/ct-file-icon.svg Minified/normalized SVG formatting/colors.
resources/static/confirm_line.svg Minified/normalized SVG formatting/colors.
resources/static/confirm_fill.svg Minified/normalized SVG formatting/colors.
resources/static/cloud_line.svg Minified/normalized SVG formatting/colors.
resources/static/cloud_fill.svg Minified/normalized SVG formatting/colors.
resources/static/close_line_dark.svg Minified/normalized SVG formatting/colors.
resources/static/close_line.svg Minified/normalized SVG formatting/colors.
resources/static/close_fill.svg Minified/normalized SVG formatting/colors.
resources/static/clear-outlined.svg Minified/normalized SVG formatting/colors.
resources/static/circle.svg Minified/normalized SVG formatting/colors.
resources/static/check.svg Minified/normalized SVG formatting/colors.
resources/static/calendar_fill_dark.svg Minified/normalized SVG formatting/colors.
resources/static/calendar_fill.svg Minified/normalized SVG formatting/colors.
resources/static/brush-fill.svg Minified/normalized SVG formatting/colors.
resources/static/bold.svg Minified/normalized SVG formatting/colors.
resources/static/big_view.svg Minified/normalized SVG formatting/colors.
resources/static/attachment_line.svg Minified/normalized SVG formatting/colors.
resources/static/arrow-right.svg Minified/normalized SVG formatting/colors.
resources/static/arrow-left.svg Minified/normalized SVG formatting/colors.
resources/static/alert_line.svg Minified/normalized SVG formatting/colors.
resources/static/alert_fill.svg Minified/normalized SVG formatting/colors.
resources/static/add_line.svg Minified/normalized SVG formatting/colors.
requirements.txt Adds openai dependency.
modules/utils/language_utils.py Adds Cantonese and HK Traditional Chinese language codes.
modules/translation/yandex.py Normalizes HK/Cantonese Chinese codes to zh-TW for Yandex.
modules/translation/microsoft.py Adds HK/Cantonese mapping in Microsoft translator language preprocessing.
modules/translation/llm/xai.py New xAI (Grok) OpenAI-compatible REST translation engine.
modules/translation/llm/openrouter.py New OpenRouter OpenAI-compatible REST translation engine (with optional image input).
modules/translation/llm/github.py New GitHub Models OpenAI-compatible REST translation engine.
modules/translation/factory.py Wires in new engines and adjusts engine initialization logic.
modules/translation/deepl.py Adds HK/Cantonese normalization to ZH-HANT for DeepL.
modules/rendering/render.py Treats zh-HK/yue as vertical-language eligible.
docs/README_zh-CN.md Adds Traditional Chinese link and updates download URL.
docs/README_ko.md Adds Traditional Chinese link and updates download URL.
docs/README_fr.md Adds Traditional Chinese link and updates download URL.
comic.py Adds locale-based Chinese variant selection and translation-file mapping.
app/ui/settings/settings_ui.py Adds new UI languages and language-code mappings.
app/ui/main_window.py Adds Cantonese (HK) to supported target languages list.
README.md Adds Traditional Chinese doc link and updates download URL text.
.gitignore Ignores *.ctpr files.
Comments suppressed due to low confidence (1)

comic.py:440

  • When the stored language is 'yue', file_code is correctly mapped to zh-HK, but qt_lang_code is derived from lang_code (still 'yue'), so Qt base translations will try to load qtbase_yue and fail. Consider deriving qt_lang_code from file_code (or mapping 'yue''zh-HK') so Qt UI strings localize consistently.
    # Map internal codes to translation file codes
    code_to_file = {
        'yue': 'zh-HK',  # Cantonese uses Hong Kong Chinese translation
        'zh-HK': 'zh-HK',
        'zh-TW': 'zh-TW',
        'zh-CN': 'zh-CN',
        'ko': 'ko',
        'fr': 'fr',
        'ru': 'ru',
        'de': 'de',
        'es': 'es',
        'it': 'it',
        'tr': 'tr',
    }

    # If language is a display name, convert to code
    if language in display_name_to_code:
        lang_code = display_name_to_code[language]
    else:
        lang_code = language

    # If language code needs mapping to file code, map it
    if lang_code in code_to_file:
        file_code = code_to_file[lang_code]
    else:
        file_code = lang_code

    if not file_code or file_code == 'English':
        return

    # Load the translation file
    current_file_dir = os.path.dirname(os.path.abspath(__file__))
    tr_dir = os.path.join(current_file_dir, 'resources', 'translations', 'compiled')

    if translator.load(f"ct_{file_code}", tr_dir):
        app.installTranslator(translator)
    else:
        print(f"Failed to load translation for {language}")

    # Load standard Qt translations
    qt_translator = QTranslator(app)
    # qtbase uses underscores (e.g. qtbase_zh_CN.qm, qtbase_fr.qm)
    qt_lang_code = lang_code.replace('-', '_')
    from PySide6.QtCore import QLibraryInfo

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

# Create reverse mappings for loading
# Create reverse mappings for loading
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

Indentation is broken here: the comment line is unindented, which ends the init block and makes the following indented assignment (self.reverse_mappings = ...) raise an IndentationError: unexpected indent at import time. Keep the comment and the self.reverse_mappings line indented to the same level as other statements in __init__.

Suggested change
# Create reverse mappings for loading
# Create reverse mappings for loading

Copilot uses AI. Check for mistakes.
else:
engine.initialize(settings, source_lang, target_lang)
engine.initialize(settings, source_lang, target_lang, "")
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

create_engine initializes traditional engines with an extra positional argument (""), but DeepLTranslation.initialize, MicrosoftTranslation.initialize, and YandexTranslation.initialize only accept (settings, source_lang, target_lang). This will raise a TypeError when selecting a traditional engine. Call engine.initialize(settings, source_lang, target_lang) for traditional engines.

Suggested change
engine.initialize(settings, source_lang, target_lang, "")
# Traditional engines expect initialize(settings, source_lang, target_lang)
engine.initialize(settings, source_lang, target_lang)

Copilot uses AI. Check for mistakes.
return '繁體中文'
else:
# fallback for unknown Chinese locales, default to Simplified
return '中文'
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

For zh_ locales with an unrecognized region, this returns '中文', but that display name/code isn’t handled by load_translation and will cause translation loading to fail. The comment says the fallback should be Simplified; consider returning '简体中文' (or mapping '中文' explicitly in load_translation).

Suggested change
return '中文'
return '简体中文'

Copilot uses AI. Check for mistakes.
Download and install Comic Translate for Windows and macOS from [here](https://www.comic-translate.com/download/).

>Ignore Smart Screen for Windows (Click More info > Run anyway). For macOS, after trying to open, go to Settings > Privacy and Security > Scroll down and click Open Anyway.
>Ignore Smart Screen for Windows (Click More info > Run anyway. For macOS, after trying to open, go to Settings > Privacy and Security > Scroll down and click Open Anyway.
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

Markdown formatting regression: the parenthesis opened after "Run anyway" is no longer closed, which breaks the blockquote line. Restore the closing ) so the sentence renders correctly.

Suggested change
>Ignore Smart Screen for Windows (Click More info > Run anyway. For macOS, after trying to open, go to Settings > Privacy and Security > Scroll down and click Open Anyway.
>Ignore Smart Screen for Windows (Click More info > Run anyway). For macOS, after trying to open, go to Settings > Privacy and Security > Scroll down and click Open Anyway.

Copilot uses AI. Check for mistakes.
Comment on lines +33 to +34
credentials = settings.get_credentials(settings.ui.tr('xAI'))
self.api_key = credentials.get('api_key', '')
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

Same issue as other new LLM engines: settings.get_credentials(settings.ui.tr('xAI')) won’t return an api_key with the current credentials implementation (it only supports Custom). This will leave self.api_key empty and all API calls unauthorized. Wire up credentials for xAI or adjust how credentials are retrieved.

Suggested change
credentials = settings.get_credentials(settings.ui.tr('xAI'))
self.api_key = credentials.get('api_key', '')
# Try to get credentials specific to xAI; fall back to "Custom" if not available.
_credentials = settings.get_credentials(settings.ui.tr('xAI')) or {}
api_key = _credentials.get('api_key')
if not api_key:
custom_credentials = settings.get_credentials(settings.ui.tr('Custom')) or {}
api_key = custom_credentials.get('api_key', '')
self.api_key = api_key

Copilot uses AI. Check for mistakes.
Comment on lines +33 to +36
credentials = settings.get_credentials(settings.ui.tr('OpenRouter'))
self.api_key = credentials.get('api_key', '')
self.model = MODEL_MAP.get(self.model_name, self.model_name)

Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

These engines fetch credentials via settings.get_credentials(settings.ui.tr('OpenRouter')) (and similar for GitHub/xAI), but SettingsPage.get_credentials() currently only populates fields for the Custom service; other services return only {'save_key': ...}. As a result, self.api_key will always be empty and requests will fail. Either extend the credentials UI/storage to include these services (and add matching value_mappings entries), or fetch credentials via a consistent key that get_credentials supports.

Suggested change
credentials = settings.get_credentials(settings.ui.tr('OpenRouter'))
self.api_key = credentials.get('api_key', '')
self.model = MODEL_MAP.get(self.model_name, self.model_name)
# Prefer credentials stored under the generic "Custom" service, which is
# the only one guaranteed to include an 'api_key' field in
# SettingsPage.get_credentials(). Fall back to any OpenRouter-specific
# credentials if present.
custom_credentials = settings.get_credentials(settings.ui.tr('Custom'))
openrouter_credentials = settings.get_credentials(settings.ui.tr('OpenRouter'))
credentials = custom_credentials or openrouter_credentials or {}
self.api_key = credentials.get('api_key', '')
self.model = MODEL_MAP.get(self.model_name, self.model_name)
if not self.api_key:
raise RuntimeError(
"OpenRouter API key is not configured. Please set an API key in the "
"Custom service credentials in the settings."
)

Copilot uses AI. Check for mistakes.
Comment on lines +33 to +34
credentials = settings.get_credentials(settings.ui.tr('GitHub'))
self.api_key = credentials.get('api_key', '')
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

Same issue as other new LLM engines: settings.get_credentials(settings.ui.tr('GitHub')) won’t return an api_key with the current credentials implementation (it only supports Custom). This will leave self.api_key empty and all API calls unauthorized. Wire up credentials for GitHub Models or adjust how credentials are retrieved.

Suggested change
credentials = settings.get_credentials(settings.ui.tr('GitHub'))
self.api_key = credentials.get('api_key', '')
# Try GitHub-specific credentials first
credentials = settings.get_credentials(settings.ui.tr('GitHub')) or {}
api_key = credentials.get('api_key') or credentials.get('api_token')
# Fallback to Custom credentials if no GitHub API key is configured
if not api_key:
custom_credentials = settings.get_credentials(settings.ui.tr('Custom')) or {}
api_key = custom_credentials.get('api_key') or custom_credentials.get('api_token')
self.api_key = api_key or ''

Copilot uses AI. Check for mistakes.
self.api_base_url = "https://models.inference.ai.azure.com"
self.supports_images = False

def initialize(self, settings: Any, source_lang: str, target_lang: str, model_name: str, **kwargs) -> None:
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

This method requires 5 positional arguments, whereas overridden BaseLLMTranslation.initialize requires 4.
This method requires 5 positional arguments, whereas overridden TranslationEngine.initialize requires 4.

Copilot uses AI. Check for mistakes.
self.api_base_url = "https://openrouter.ai/api/v1"
self.supports_images = True

def initialize(self, settings: Any, source_lang: str, target_lang: str, model_name: str, **kwargs) -> None:
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

This method requires 5 positional arguments, whereas overridden BaseLLMTranslation.initialize requires 4.
This method requires 5 positional arguments, whereas overridden TranslationEngine.initialize requires 4.

Copilot uses AI. Check for mistakes.
@mythic3011 mythic3011 marked this pull request as draft February 8, 2026 16:03
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