diff --git a/U.sh b/U.sh index 482cbe9..2f5ead2 100755 --- a/U.sh +++ b/U.sh @@ -391,6 +391,15 @@ Every package you add means you are adding a vulnerability to your site. 343- Check this link, this link should be shows -->> سلام -->> http://127.0.0.1:8000/products/hello/ 344- import this into models.py -> from django.utils.translation import gettext_lazy as _ 345- Change this in class of Comment in products/models.py +346- In Terminal (in products directory Terminal) --> django-admin makemessages -l fa +347- Translate in file products/locale/fa/LC_MESSAGES/django.mo , add a translate for 'Test' +348- In Terminal (in products directory Terminal) +349- add
tag after this line in product_detail.html +350- Go this link and check comment table +351- add this in products/models.py +352- in Terminal +353- in products/locale/LC_MESSAGES/django.po Change theses +354-in Terminal " git push -u origin main diff --git a/products/locale/fa/LC_MESSAGES/django.mo b/products/locale/fa/LC_MESSAGES/django.mo index b1c397b..170fd72 100644 Binary files a/products/locale/fa/LC_MESSAGES/django.mo and b/products/locale/fa/LC_MESSAGES/django.mo differ diff --git a/products/locale/fa/LC_MESSAGES/django.po b/products/locale/fa/LC_MESSAGES/django.po index b930132..327fd0a 100644 --- a/products/locale/fa/LC_MESSAGES/django.po +++ b/products/locale/fa/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-30 10:03-0500\n" +"POT-Creation-Date: 2024-02-15 22:12-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,6 +18,26 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: models.py:30 +msgid "Very bad" +msgstr "خیلی بد" + +#: models.py:31 +msgid "Bad" +msgstr "بد" + +#: models.py:32 +msgid "Ordinary" +msgstr "معمولی" + +#: models.py:33 +msgid "Good" +msgstr "خوب" + +#: models.py:34 +msgid "Perfect" +msgstr "خیلی خوب" + #: models.py:44 msgid "Text" msgstr "متن دیدگاه" @@ -36,7 +56,7 @@ msgstr "توضیحات محصول" msgid "Write your comment" msgstr "نظر خود را بنویسید" -#: templates/products/product_detail.html:155 +#: templates/products/product_detail.html:156 msgid "Submit" msgstr "" diff --git a/products/models.py b/products/models.py index c903d92..b5f222e 100644 --- a/products/models.py +++ b/products/models.py @@ -27,11 +27,11 @@ def get_queryset(self): class Comment(models.Model): PRODUCT_STARS = [ - ('1', 'Very bad'), - ('2', 'Bad'), - ('3', 'Ordinary'), - ('4', 'Good'), - ('5', 'Perfect'), + ('1', _('Very bad')), + ('2', _('Bad')), + ('3', _('Ordinary')), + ('4', _('Good')), + ('5', _('Perfect')), ] product = models.ForeignKey(Product, on_delete=models.CASCADE, related_name='comments', )