feat: add option to ignore cache and retranslate#733
feat: add option to ignore cache and retranslate#733awwaawwa merged 5 commits intoPDFMathTranslate:mainfrom Cycloctane:ignore_cache
Conversation
|
pdf2zh/gui.py has another one around line 400. |
There was a problem hiding this comment.
PR Overview
This PR adds support for an option to ignore translation caching throughout the application. The changes include adding a new command‐line argument (--ignore-cache) in the docs, CLI parser, and README, propagating the option to the translator constructors (including GUI and converter modules), and updating tests to account for the new parameter.
Reviewed Changes
| File | Description |
|---|---|
| docs/ADVANCED.md | Documents the new "Translation cache" section and the --ignore-cache option. |
| pdf2zh/pdf2zh.py | Adds the --ignore-cache argument to the parser and passes it to the translator. |
| pdf2zh/gui.py | Updates GUI functions to support and forward the ignore_cache option. |
| pdf2zh/translator.py | Modifies BaseTranslator and its subclasses to accept an ignore_cache parameter. |
| README.md | Documents the new command-line option in the usage table. |
| pdf2zh/high_level.py | Propagates the ignore_cache flag to translation patch functions. |
| test/test_translator.py | Updates translator instantiation in tests to include the new parameter. |
| pdf2zh/converter.py | Passes the ignore_cache option from the converter to the translator. |
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
test/test_translator.py:33
- Consider adding tests that verify the behavior when ignore_cache is set to True, ensuring that the caching mechanism is bypassed as expected.
translator = AutoIncreaseTranslator("en", "zh", "test", False)
pdf2zh/translator.py:54
- [nitpick] Consider providing a default value for the ignore_cache parameter (e.g. ignore_cache: bool = False) in BaseTranslator's constructor to reduce the impact on existing usages.
def __init__(self, lang_in: str, lang_out: str, model: str, ignore_cache: bool):
|
Thank you for your contribution. According to https://funstory-ai.github.io/BabelDOC/CONTRIBUTOR_REWARD/ , you can apply for a monthly membership redemption code for Immersive Translate. |
related issue: #731