Skip to content

Commit

Permalink
add persian month
Browse files Browse the repository at this point in the history
  • Loading branch information
dori-dev committed Apr 14, 2023
1 parent f723e34 commit b7d5707
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
Binary file modified src/language/locale/fa/LC_MESSAGES/django.mo
Binary file not shown.
36 changes: 36 additions & 0 deletions src/language/locale/fa/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,39 @@ msgstr "کد تاییدی که وارد کردی اشتباه است."

msgid "First apply to get the verification code."
msgstr "اول برای دریافت کد تایید درخواست بده."

msgid "Farvardin"
msgstr "فروردین"

msgid "Ordibehesht"
msgstr "اردیبهشت"

msgid "Khordad"
msgstr "خرداد"

msgid "Tir"
msgstr "تیر"

msgid "Mordad"
msgstr "مرداد"

msgid "Shahrivar"
msgstr "شهریور"

msgid "Mehr"
msgstr "مهر"

msgid "Aban"
msgstr "آبان"

msgid "Azar"
msgstr "آذر"

msgid "Dey"
msgstr "دی"

msgid "Bahman"
msgstr "بهمن"

msgid "Esfand"
msgstr "اسفند"
8 changes: 6 additions & 2 deletions src/post/templates/post/detail.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% load jformat timesince post %}
{% load jformat i18n timesince post %}

{% block title %}پست {{ post.user.username }}{% endblock title %}

Expand Down Expand Up @@ -90,7 +90,11 @@
</button>
</div>
<div class="col-6 text-end">
{{ post.created|jformat:"%d %B %Y" }}
{% with date=post.created|jformat:"%d %B %Y" %}
{% for word in date|split_string %}
{% translate word %}
{% endfor %}
{% endwith %}
</div>
</div>
<div class="modal fade" id="likeList" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
Expand Down
5 changes: 5 additions & 0 deletions src/post/templatetags/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@
def render(content):
content = re.sub(r"#(\w+)", r"<a href='/posts/tag/\1/'>#\1</a>", content)
return mark_safe(content)


@register.filter
def split_string(value: str):
return value.split()

0 comments on commit b7d5707

Please sign in to comment.