You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from deep_translator import GoogleTranslator
names = name.split(" ")
res = []
for name in names:
if has_arabic(name):
s = "اسمي هو محمد " + name # اسمي مش محمد
translated = GoogleTranslator(source="auto", target="english").translate(
text=s
)
translated_array = translated.split(" ")
if len(translated_array) <= 3:
return translated_array[-1]
res.extend(translated_array[4:])
else:
res.append(name)
return " ".join(res)
print(translate_name("احمد"))
`
The following code worked previously now it's returning this Error 500 (Server Error)!!1500.That’s an error.There was an error. Please try again later.That’s all we know.
I believe this error is infamous with google stuff, maybe it's down
The text was updated successfully, but these errors were encountered:
`import re
def translate_name(name):
def has_arabic(text):
# Regular expression pattern for Arabic characters
arabic_pattern = re.compile(r"[\u0600-\u06FF]")
return bool(arabic_pattern.search(text))
print(translate_name("احمد"))
`
The following code worked previously now it's returning this Error 500 (Server Error)!!1500.That’s an error.There was an error. Please try again later.That’s all we know.
I believe this error is infamous with google stuff, maybe it's down
The text was updated successfully, but these errors were encountered: