Skip to content

Commit 2393468

Browse files
committed
Farsi messages added
1 parent e0e884e commit 2393468

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed

src/pyvalidations/lang/fa.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
class Fa:
2+
"""
3+
Validation Exception message in English
4+
:param attribute : name of validation target
5+
:param value : value of attribute
6+
"""
7+
8+
def __init__(self, attribute, value):
9+
self.attribute = attribute
10+
self.value = value
11+
12+
def messages(self):
13+
"""
14+
validation messages
15+
:return: dict
16+
"""
17+
return {
18+
"field": f" فیلد{self.attribute} وجود ندارد ",
19+
"required": f" فیلد{self.attribute} الزامی است. ",
20+
"required_if": f" وقتی {self.value} وجود داشته باشد، فیلد {self.attribute} مورد نیاز است. ",
21+
"required_unless": f" فیلد {self.attribute} مورد نیاز است مگر اینکه {self.value} وجود نداشته باشد یا خالی باشد. ",
22+
"required_with": f" فیلد {self.attribute} زمانی لازم است که {self.value} وجود داشته باشد.",
23+
"required_without": f" فیلد {self.attribute} زمانی لازم است که {self.value} موجود باشد/نیست.",
24+
"accepted": f"{self.attribute} باید پذیرفته شود. ",
25+
"alpha": f"{self.attribute} باید فقط دارای حروف باشد. ",
26+
"boolean": f" مقدار {self.attribute} باید: true، false، 1 یا 0 باشد.",
27+
"string": f"{self.attribute}باید از نوع متنی باشد. ",
28+
"start_with": f"{self.attribute} باید با {self.value} شروع شود.",
29+
"end_with": f"{self.attribute} باید با {self.value} ختم شود.",
30+
"numeric": f"{self.attribute} باید یک عدد باشد. ",
31+
"digits": f"{self.attribute} باید رقم {self.value} باشد.",
32+
"max": f"{self.attribute} نباید بزرگتر از {self.value} باشد. ",
33+
"min": f"{self.attribute} باید حداقل {self.value} باشد. ",
34+
"email": f"{self.attribute} باید یک آدرس ایمیل معتبر باشد. ",
35+
"url": f"{self.attribute} باید یک آدرس URL معتبر باشد.",
36+
"ip": f"{self.attribute} باید یک آدرس IP معتبر باشد. ",
37+
"ipv4": f"{self.attribute} باید یک آدرس IPv4 معتبر باشد.",
38+
"ipv6": f"{self.attribute} باید یک آدرس IPv6 معتبر باشد.",
39+
"in": f"{self.attribute} انتخاب شده نامعتبر است. ",
40+
"not_in": f"{self.attribute} انتخاب شده نامعتبر است.",
41+
"uuid": f"{self.attribute} باید یک UUID معتبر باشد.",
42+
"date": f"{self.attribute} تاریخ معتبری نیست. ",
43+
"time": f"{self.attribute} زمان معتبری نیست.",
44+
"datetime": f"{self.attribute} تاریخ معتبری نیست.",
45+
"timezone": f"{self.attribute} یک منطقه زمانی معتبر نیست. ",
46+
"date_equals": f"{self.attribute} باید تاریخی برابر با {self.value} باشد. ",
47+
"after": f"{self.attribute} باید تاریخ بعد از {self.value} باشد.",
48+
"after_or_equal": f"{self.attribute} باید تاریخ بعد یا برابر با {self.value} باشد.",
49+
"before": f"{self.attribute} باید تاریخ قبل از {self.value} باشد.",
50+
"before_or_equal": f"{self.attribute} باید تاریخ قبل یا برابر با {self.value} باشد.",
51+
"different": f"{self.attribute} باید با {self.value} متفاوت باشد.",
52+
"equal": f"{self.attribute} باید برابر با {self.value} باشد.",
53+
"gt": f"{self.attribute} باید بزرگتر از {self.value} باشد.",
54+
"gte": f"{self.attribute} باید بزرگتر یا مساوی با {self.value} باشد.",
55+
"lt": f"{self.attribute} باید کمتر از {self.value} باشد. ",
56+
"lte": f"{self.attribute} باید کمتر یا برابر با {self.value} باشد.",
57+
"confirmed": f"تأیید {self.attribute} مطابقت ندارد.",
58+
"nullable": f"{self.attribute} می تواند تهی باشد.",
59+
"file": f"{self.attribute} باید یک فایل باشد.",
60+
"mimes": f"{self.attribute} باید فایلی از نوع: {self.value} باشد.",
61+
"mime_types": f"{self.attribute} باید فایلی از نوع: {self.value} باشد.",
62+
"max_size": f"{self.attribute} نباید بیشتر از {self.value} کیلوبایت باشد.",
63+
"min_size": f"{self.attribute} باید حداقل {self.value} کیلوبایت باشد.",
64+
}

src/pyvalidations/lang/language.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from .en import En
22
from .de import De
3+
from .fa import Fa
34

45

56
class Languages:
@@ -34,5 +35,6 @@ def messages(self):
3435
"""
3536
return {
3637
"en": En(self.__key, self.__value).messages(),
37-
"de": De(self.__key, self.__value).messages()
38+
"de": De(self.__key, self.__value).messages(),
39+
"fa": Fa(self.__key, self.__value).messages(),
3840
}

0 commit comments

Comments
 (0)