Skip to content

Commit

Permalink
Check num table on translate (to fira) (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
OK-Diamond authored Feb 11, 2025
1 parent 680bfff commit d52ffb8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,11 @@ def translate(self, command_list: list[str], **kwargs) -> str:
elif str.lower(command_list[2]) in ["f", "fira"]:
root_translation = self.root_word_table.list_record(f"WHERE wordEng = \"{word}\"", "wordFira")
complex_translation = self.word_table.list_record(f"WHERE wordEng = \"{word}\"", "wordFira")
# If the word is a digit, check the num table
if word.isdigit():
num_translation = self.num_table.list_record(f"WHERE value = {word}", "wordFira")
if len(num_translation) > 0:
complex_translation = num_translation
else:
raise Fs.FSSyntaxError(f"{func_name} ERROR: 「{' '.join(command_list)}」 not in format '<string> TO <e|f>', missing <e|f>.")
else:
Expand Down

0 comments on commit d52ffb8

Please # to comment.