This commit is contained in:
2026-02-01 08:26:08 +03:30
parent 6c74e43629
commit 521dd9da5c
81 changed files with 103 additions and 53 deletions

View File

@@ -146,6 +146,26 @@ def api_get_hatching_permit_code(request):
return Response({'detail': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
def normalize_persian_arabic_text(text):
"""
نرمال‌سازی متن فارسی/عربی برای یکسان‌سازی کاراکترهای مشابه
تبدیل کاراکترهای فارسی به عربی برای سازگاری با دیتابیس
این تابع کاراکترهای 'ک' و 'ی' فارسی را به 'ك' و 'ي' عربی تبدیل می‌کند
تا با فرم استاندارد ذخیره شده در دیتابیس مطابقت داشته باشد
"""
if not text:
return text
# تبدیل کاراکترهای فارسی به عربی
# 'ک' (U+06A9 - Persian Kaf) -> 'ك' (U+0643 - Arabic Kaf)
# 'ی' (U+06CC - Persian Yeh) -> 'ي' (U+064A - Arabic Yeh)
text = str(text)
text = text.replace('ک', 'ك') # Persian Kaf to Arabic Kaf
text = text.replace('ی', 'ي') # Persian Yeh to Arabic Yeh
return text
def create_guild(**info):
Guilds(