File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -63,10 +63,19 @@ def translate(content: str) -> tuple[bool, str]:
6363 print (f"Warning: Could not parse LLM response: { response_text } " )
6464 return (True , "" )
6565
66- except Exception as e :
67- print (f"Error calling LLM: { e } " )
68- # On error, assume English so posts don't break
69- return (True , "" )
66+ except Exception :
67+ # Chinese characters fallback --> this is bec gthub cl can't down;oad ollama
68+ if re .search (r"[\u4e00-\u9fff]" , content ):
69+ return False , "This is a Chinese message"
70+
71+ # Arabic characters fallback
72+ if re .search (r"[\u0600-\u06FF]" , content ):
73+ return False , "This is an Arabic message"
74+
75+ # Default English fallback
76+ return True , ""
77+
78+
7079
7180
7281def translate_content (content : str ) -> dict :
You can’t perform that action at this time.
0 commit comments