fix trasnlator issues

This commit is contained in:
Wolfang Torres
2026-06-21 13:31:35 +08:00
parent 5b52c5ae96
commit e945d53f85
3 changed files with 4 additions and 3 deletions

View File

@@ -60,12 +60,13 @@ def cli_select_language(languages: list = None) -> str:
raise ValueError("""No languages are avaliable,
if this is a dictionay file, you must preprocess it first""")
print("Select a language:")
for language_id, language in avaliable_languages.items():
for language_id, language in avaliable_languages:
if languages and language_id in languages:
print(f"{language_id} - {language}")
s = None
while not s or s not in LANGUAGES.AvailableLanguages:
s = input(f"Please select the language {avaliable_languages.keys()}: ")
lan_codes = [lan_id for lan_id, lan in avaliable_languages]
s = input(f"Please select the language {', '.join(lan_codes)}: ")
return s

View File

@@ -196,6 +196,7 @@ def write_resource_file(process_file: ProcessFile, language_id: str, text: str):
def pre_process_a_dictionary_file(process_file: ProcessFile, language_id: str):
"""From a input_file, a language_id and an output type, process a file"""
process_file.language_id = language_id
TRANS.create_translator(LANGUAGES.EN, language_id)
CCCEDICT.create_cedict(language_id)
with process_file.absolute_input_file.open(
"r", encoding="utf8", newline="\n"

View File

@@ -58,7 +58,6 @@ class TranslatedEntry:
self.entry = entry
self.language_id = language_id
self._translated_meanings = []
TRANS.create_translator(LANGUAGES.EN, language_id)
@property
def simplified(self):