update format for anki,

upgrade trasnlation package search,
fix small bugs
This commit is contained in:
Wolfang Torres
2026-06-12 00:43:55 +08:00
parent 21c6416cfd
commit eb4cc8e6e0
10 changed files with 70 additions and 45 deletions

View File

@@ -33,13 +33,20 @@ class TRANS:
argostranslate.package.update_package_index()
TRANS.PACKAGES = argostranslate.package.get_available_packages()
TRANS.UPDATED = True
package_to_install = next(
filter(
lambda x: x.from_code == from_code and x.to_code == to_code,
packages = filter(
lambda x: x.from_code == from_code or x.to_code == to_code,
TRANS.PACKAGES,
)
)
argostranslate.package.install_from_path(package_to_install.download())
packages_to_install = []
for in_package in packages:
if in_package.from_code == from_code:
for out_package in packages:
if out_package.to_code == to_code:
if in_package.to_code == out_package.from_code:
packages_to_install.append(in_package)
packages_to_install.append(out_package)
for package in packages_to_install:
argostranslate.package.install_from_path(package.download())
class CCCEDICT:
@@ -135,7 +142,7 @@ class ProcessFile:
"""Posible name for the output file, still missing the filetype"""
if self.language_id is None:
raise ValueError("Not a valid language selected")
return self.input_file.parent / f"{self.input_file.stem}.{self.language_id})."
return self.out_folder / f"{self.input_file.stem}.{self.language_id}."
class TranslationResult: