Fix trans + update DB query

This commit is contained in:
cuom1999 2023-07-26 23:52:34 +07:00
parent 9019bcb990
commit daee631ef6
4 changed files with 196 additions and 174 deletions

View file

@ -404,8 +404,16 @@ class SubmissionsListBase(DiggPaginatorMixin, TitleMixin, ListView):
) )
if self.selected_languages: if self.selected_languages:
# Note (DMOJ): MariaDB can't optimize this subquery for some insane, unknown reason,
# so we are forcing an eager evaluation to get the IDs right here.
# Otherwise, with multiple language filters, MariaDB refuses to use an index
# (or runs the subquery for every submission, which is even more horrifying to think about).
queryset = queryset.filter( queryset = queryset.filter(
language__in=Language.objects.filter(key__in=self.selected_languages) language__in=list(
Language.objects.filter(
key__in=self.selected_languages
).values_list("id", flat=True)
)
) )
if self.selected_statuses: if self.selected_statuses:
submission_results = [i for i, _ in Submission.RESULT] submission_results = [i for i, _ in Submission.RESULT]

View file

@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: lqdoj2\n" "Project-Id-Version: lqdoj2\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-05-22 23:06+0700\n" "POT-Creation-Date: 2023-07-26 22:55+0700\n"
"PO-Revision-Date: 2021-07-20 03:44\n" "PO-Revision-Date: 2021-07-20 03:44\n"
"Last-Translator: Icyene\n" "Last-Translator: Icyene\n"
"Language-Team: Vietnamese\n" "Language-Team: Vietnamese\n"
@ -231,7 +231,7 @@ msgstr "Ngôn ngữ"
msgid "History" msgid "History"
msgstr "Lịch sử" msgstr "Lịch sử"
#: judge/admin/problem.py:271 templates/problem/list-base.html:100 #: judge/admin/problem.py:271 templates/problem/list-base.html:99
msgid "Authors" msgid "Authors"
msgstr "Các tác giả" msgstr "Các tác giả"
@ -467,7 +467,7 @@ msgstr ""
msgid "New IOI" msgid "New IOI"
msgstr "IOI mới" msgstr "IOI mới"
#: judge/forms.py:107 judge/views/organization.py:520 #: judge/forms.py:107 judge/views/organization.py:513
#: judge/views/register.py:62 #: judge/views/register.py:62
#, python-brace-format #, python-brace-format
msgid "You may not be part of more than {count} public groups." msgid "You may not be part of more than {count} public groups."
@ -2514,11 +2514,11 @@ msgstr "Tính lại điểm kỳ thi"
msgid "Running MOSS" msgid "Running MOSS"
msgstr "Đang chạy MOSS" msgstr "Đang chạy MOSS"
#: judge/tasks/submission.py:49 #: judge/tasks/submission.py:47
msgid "Modifying submissions" msgid "Modifying submissions"
msgstr "Chỉnh sửa bài nộp" msgstr "Chỉnh sửa bài nộp"
#: judge/tasks/submission.py:69 #: judge/tasks/submission.py:67
msgid "Recalculating user points" msgid "Recalculating user points"
msgstr "Tính lại điểm người dùng" msgstr "Tính lại điểm người dùng"
@ -2658,12 +2658,12 @@ msgstr "Bạn phải giải ít nhất 1 bài trước khi được vote."
msgid "You already voted." msgid "You already voted."
msgstr "Bạn đã vote." msgstr "Bạn đã vote."
#: judge/views/comment.py:255 judge/views/organization.py:817 #: judge/views/comment.py:253 judge/views/organization.py:810
#: judge/views/organization.py:963 judge/views/organization.py:1128 #: judge/views/organization.py:956 judge/views/organization.py:1121
msgid "Edited from site" msgid "Edited from site"
msgstr "Chỉnh sửa từ web" msgstr "Chỉnh sửa từ web"
#: judge/views/comment.py:276 #: judge/views/comment.py:274
msgid "Editing comment" msgid "Editing comment"
msgstr "Chỉnh sửa bình luận" msgstr "Chỉnh sửa bình luận"
@ -2877,7 +2877,7 @@ msgstr "Bạn không được phép chỉnh sửa tổ chức này."
#: judge/views/organization.py:230 judge/views/register.py:48 #: judge/views/organization.py:230 judge/views/register.py:48
#: judge/views/stats.py:184 templates/contest/list.html:89 #: judge/views/stats.py:184 templates/contest/list.html:89
#: templates/problem/list-base.html:98 templates/stats/site.html:33 #: templates/problem/list-base.html:97 templates/stats/site.html:33
#: templates/user/user-left-sidebar.html:4 templates/user/user-list-tabs.html:6 #: templates/user/user-left-sidebar.html:4 templates/user/user-list-tabs.html:6
msgid "Groups" msgid "Groups"
msgstr "Nhóm" msgstr "Nhóm"
@ -2887,52 +2887,52 @@ msgstr "Nhóm"
msgid "%s Members" msgid "%s Members"
msgstr "%s Thành viên" msgstr "%s Thành viên"
#: judge/views/organization.py:476 #: judge/views/organization.py:469
#, python-brace-format #, python-brace-format
msgid "All submissions in <a href=\"{1}\">{0}</a>" msgid "All submissions in <a href=\"{1}\">{0}</a>"
msgstr "Bài nộp trong <a href=\"{1}\">{0}</a>" msgstr "Bài nộp trong <a href=\"{1}\">{0}</a>"
#: judge/views/organization.py:506 judge/views/organization.py:512 #: judge/views/organization.py:499 judge/views/organization.py:505
#: judge/views/organization.py:519 #: judge/views/organization.py:512
msgid "Joining group" msgid "Joining group"
msgstr "Tham gia nhóm" msgstr "Tham gia nhóm"
#: judge/views/organization.py:507 #: judge/views/organization.py:500
msgid "You are already in the group." msgid "You are already in the group."
msgstr "Bạn đã ở trong nhóm." msgstr "Bạn đã ở trong nhóm."
#: judge/views/organization.py:512 #: judge/views/organization.py:505
msgid "This group is not open." msgid "This group is not open."
msgstr "Nhóm này là nhóm kín." msgstr "Nhóm này là nhóm kín."
#: judge/views/organization.py:535 #: judge/views/organization.py:528
msgid "Leaving group" msgid "Leaving group"
msgstr "Rời nhóm" msgstr "Rời nhóm"
#: judge/views/organization.py:536 #: judge/views/organization.py:529
#, python-format #, python-format
msgid "You are not in \"%s\"." msgid "You are not in \"%s\"."
msgstr "Bạn không ở trong \"%s\"." msgstr "Bạn không ở trong \"%s\"."
#: judge/views/organization.py:561 #: judge/views/organization.py:554
#, python-format #, python-format
msgid "Request to join %s" msgid "Request to join %s"
msgstr "Đăng ký tham gia %s" msgstr "Đăng ký tham gia %s"
#: judge/views/organization.py:591 #: judge/views/organization.py:584
msgid "Join request detail" msgid "Join request detail"
msgstr "Chi tiết đơn đăng ký" msgstr "Chi tiết đơn đăng ký"
#: judge/views/organization.py:633 #: judge/views/organization.py:626
msgid "Manage join requests" msgid "Manage join requests"
msgstr "Quản lý đơn đăng ký" msgstr "Quản lý đơn đăng ký"
#: judge/views/organization.py:637 #: judge/views/organization.py:630
#, python-format #, python-format
msgid "Managing join requests for %s" msgid "Managing join requests for %s"
msgstr "Quản lý đơn đăng ký cho %s" msgstr "Quản lý đơn đăng ký cho %s"
#: judge/views/organization.py:677 #: judge/views/organization.py:670
#, python-format #, python-format
msgid "" msgid ""
"Your organization can only receive %d more members. You cannot approve %d " "Your organization can only receive %d more members. You cannot approve %d "
@ -2941,96 +2941,96 @@ msgstr ""
"Tổ chức chỉ có thể chứa %d thành viên. Bạn không thể chấp thuận nhiều hơn %d " "Tổ chức chỉ có thể chứa %d thành viên. Bạn không thể chấp thuận nhiều hơn %d "
"người." "người."
#: judge/views/organization.py:695 #: judge/views/organization.py:688
#, python-format #, python-format
msgid "Approved %d user." msgid "Approved %d user."
msgid_plural "Approved %d users." msgid_plural "Approved %d users."
msgstr[0] "Đã chấp thuận %d người." msgstr[0] "Đã chấp thuận %d người."
#: judge/views/organization.py:698 #: judge/views/organization.py:691
#, python-format #, python-format
msgid "Rejected %d user." msgid "Rejected %d user."
msgid_plural "Rejected %d users." msgid_plural "Rejected %d users."
msgstr[0] "Đã từ chối %d người." msgstr[0] "Đã từ chối %d người."
#: judge/views/organization.py:738 #: judge/views/organization.py:731
#, python-format #, python-format
msgid "Add member for %s" msgid "Add member for %s"
msgstr "Thêm thành viên cho %s" msgstr "Thêm thành viên cho %s"
#: judge/views/organization.py:750 #: judge/views/organization.py:743
#, fuzzy #, fuzzy
#| msgid "Edited from site" #| msgid "Edited from site"
msgid "Added members from site" msgid "Added members from site"
msgstr "Chỉnh sửa từ web" msgstr "Chỉnh sửa từ web"
#: judge/views/organization.py:770 judge/views/organization.py:778 #: judge/views/organization.py:763 judge/views/organization.py:771
msgid "Can't kick user" msgid "Can't kick user"
msgstr "Không thể đuổi" msgstr "Không thể đuổi"
#: judge/views/organization.py:771 #: judge/views/organization.py:764
msgid "The user you are trying to kick does not exist!" msgid "The user you are trying to kick does not exist!"
msgstr "" msgstr ""
#: judge/views/organization.py:779 #: judge/views/organization.py:772
#, python-format #, python-format
msgid "The user you are trying to kick is not in organization: %s." msgid "The user you are trying to kick is not in organization: %s."
msgstr "" msgstr ""
#: judge/views/organization.py:800 judge/views/organization.py:952 #: judge/views/organization.py:793 judge/views/organization.py:945
#, fuzzy, python-format #, fuzzy, python-format
#| msgid "Editing %s" #| msgid "Editing %s"
msgid "Edit %s" msgid "Edit %s"
msgstr "Đang chỉnh sửa %s" msgstr "Đang chỉnh sửa %s"
#: judge/views/organization.py:828 templates/organization/list.html:45 #: judge/views/organization.py:821 templates/organization/list.html:45
msgid "Create group" msgid "Create group"
msgstr "Tạo nhóm" msgstr "Tạo nhóm"
#: judge/views/organization.py:843 #: judge/views/organization.py:836
msgid "Exceeded limit" msgid "Exceeded limit"
msgstr "" msgstr ""
#: judge/views/organization.py:844 #: judge/views/organization.py:837
#, python-format #, python-format
msgid "You created too many groups. You can only create at most %d groups" msgid "You created too many groups. You can only create at most %d groups"
msgstr "" msgstr ""
#: judge/views/organization.py:849 judge/views/organization.py:874 #: judge/views/organization.py:842 judge/views/organization.py:867
#: judge/views/organization.py:1018 #: judge/views/organization.py:1011
msgid "Added from site" msgid "Added from site"
msgstr "Thêm từ web" msgstr "Thêm từ web"
#: judge/views/organization.py:865 #: judge/views/organization.py:858
#: templates/organization/org-right-sidebar.html:55 #: templates/organization/org-right-sidebar.html:55
msgid "Add contest" msgid "Add contest"
msgstr "Thêm kỳ thi" msgstr "Thêm kỳ thi"
#: judge/views/organization.py:908 judge/views/organization.py:1070 #: judge/views/organization.py:901 judge/views/organization.py:1063
msgid "Permission denied" msgid "Permission denied"
msgstr "Truy cập bị từ chối" msgstr "Truy cập bị từ chối"
#: judge/views/organization.py:909 #: judge/views/organization.py:902
#, fuzzy #, fuzzy
#| msgid "You are not allowed to edit this organization." #| msgid "You are not allowed to edit this organization."
msgid "You are not allowed to edit this contest" msgid "You are not allowed to edit this contest"
msgstr "Bạn không được phép chỉnh sửa tổ chức này." msgstr "Bạn không được phép chỉnh sửa tổ chức này."
#: judge/views/organization.py:1007 #: judge/views/organization.py:1000
#, python-format #, python-format
msgid "Add blog for %s" msgid "Add blog for %s"
msgstr "Thêm bài đăng cho %s" msgstr "Thêm bài đăng cho %s"
#: judge/views/organization.py:1071 #: judge/views/organization.py:1064
msgid "Not allowed to edit this blog" msgid "Not allowed to edit this blog"
msgstr "Bạn không được phép chỉnh sửa bài đăng này." msgstr "Bạn không được phép chỉnh sửa bài đăng này."
#: judge/views/organization.py:1103 #: judge/views/organization.py:1096
#, python-format #, python-format
msgid "Edit blog %s" msgid "Edit blog %s"
msgstr "Chỉnh sửa %s" msgstr "Chỉnh sửa %s"
#: judge/views/organization.py:1154 #: judge/views/organization.py:1147
#, python-format #, python-format
msgid "Pending blogs in %s" msgid "Pending blogs in %s"
msgstr "Bài đang đợi duyệt trong %s" msgstr "Bài đang đợi duyệt trong %s"
@ -3065,30 +3065,30 @@ msgstr "Bài tập"
msgid "Problem feed" msgid "Problem feed"
msgstr "Bài tập" msgstr "Bài tập"
#: judge/views/problem.py:1070 #: judge/views/problem.py:1071
msgid "Banned from submitting" msgid "Banned from submitting"
msgstr "Bị cấm nộp bài" msgstr "Bị cấm nộp bài"
#: judge/views/problem.py:1072 #: judge/views/problem.py:1073
msgid "" msgid ""
"You have been declared persona non grata for this problem. You are " "You have been declared persona non grata for this problem. You are "
"permanently barred from submitting this problem." "permanently barred from submitting this problem."
msgstr "Bạn đã bị cấm nộp bài này." msgstr "Bạn đã bị cấm nộp bài này."
#: judge/views/problem.py:1095 #: judge/views/problem.py:1096
msgid "Too many submissions" msgid "Too many submissions"
msgstr "Quá nhiều lần nộp" msgstr "Quá nhiều lần nộp"
#: judge/views/problem.py:1097 #: judge/views/problem.py:1098
msgid "You have exceeded the submission limit for this problem." msgid "You have exceeded the submission limit for this problem."
msgstr "Bạn đã vượt quá số lần nộp cho bài này." msgstr "Bạn đã vượt quá số lần nộp cho bài này."
#: judge/views/problem.py:1176 judge/views/problem.py:1181 #: judge/views/problem.py:1177 judge/views/problem.py:1182
#, python-format #, python-format
msgid "Submit to %(problem)s" msgid "Submit to %(problem)s"
msgstr "Nộp bài cho %(problem)s" msgstr "Nộp bài cho %(problem)s"
#: judge/views/problem.py:1207 #: judge/views/problem.py:1208
msgid "Clone Problem" msgid "Clone Problem"
msgstr "Nhân bản bài tập" msgstr "Nhân bản bài tập"
@ -3242,50 +3242,50 @@ msgstr "Bài nộp của %(user)s cho bài %(problem)s"
msgid "All submissions" msgid "All submissions"
msgstr "Tất cả bài nộp" msgstr "Tất cả bài nộp"
#: judge/views/submission.py:584 judge/views/submission.py:589 #: judge/views/submission.py:590 judge/views/submission.py:595
msgid "All my submissions" msgid "All my submissions"
msgstr "Tất cả bài nộp của tôi" msgstr "Tất cả bài nộp của tôi"
#: judge/views/submission.py:585 #: judge/views/submission.py:591
#, python-format #, python-format
msgid "All submissions by %s" msgid "All submissions by %s"
msgstr "Tất cả bài nộp của %s" msgstr "Tất cả bài nộp của %s"
#: judge/views/submission.py:591 #: judge/views/submission.py:597
#, python-brace-format #, python-brace-format
msgid "All submissions by <a href=\"{1}\">{0}</a>" msgid "All submissions by <a href=\"{1}\">{0}</a>"
msgstr "Tất cả bài nộp của <a href=\"{1}\">{0}</a>" msgstr "Tất cả bài nộp của <a href=\"{1}\">{0}</a>"
#: judge/views/submission.py:612 #: judge/views/submission.py:618
#, fuzzy #, fuzzy
#| msgid "All submissions" #| msgid "All submissions"
msgid "All friend submissions" msgid "All friend submissions"
msgstr "Tất cả bài nộp" msgstr "Tất cả bài nộp"
#: judge/views/submission.py:641 #: judge/views/submission.py:647
#, python-format #, python-format
msgid "All submissions for %s" msgid "All submissions for %s"
msgstr "Tất cả bài nộp cho %s" msgstr "Tất cả bài nộp cho %s"
#: judge/views/submission.py:669 #: judge/views/submission.py:675
msgid "Must pass a problem" msgid "Must pass a problem"
msgstr "Phải làm được một bài" msgstr "Phải làm được một bài"
#: judge/views/submission.py:727 #: judge/views/submission.py:733
#, python-format #, python-format
msgid "My submissions for %(problem)s" msgid "My submissions for %(problem)s"
msgstr "Bài nộp của tôi cho %(problem)s" msgstr "Bài nộp của tôi cho %(problem)s"
#: judge/views/submission.py:728 #: judge/views/submission.py:734
#, python-format #, python-format
msgid "%(user)s's submissions for %(problem)s" msgid "%(user)s's submissions for %(problem)s"
msgstr "Các bài nộp của %(user)s cho %(problem)s" msgstr "Các bài nộp của %(user)s cho %(problem)s"
#: judge/views/submission.py:873 #: judge/views/submission.py:879
msgid "Must pass a contest" msgid "Must pass a contest"
msgstr "Phải qua một kỳ thi" msgstr "Phải qua một kỳ thi"
#: judge/views/submission.py:903 #: judge/views/submission.py:909
#, python-brace-format #, python-brace-format
msgid "" msgid ""
"<a href=\"{1}\">{0}</a>'s submissions for <a href=\"{3}\">{2}</a> in <a href=" "<a href=\"{1}\">{0}</a>'s submissions for <a href=\"{3}\">{2}</a> in <a href="
@ -3294,7 +3294,7 @@ msgstr ""
"Các bài nộp của <a href=\"{1}\">{0}</a> cho <a href=\"{3}\">{2}</a> trong <a " "Các bài nộp của <a href=\"{1}\">{0}</a> cho <a href=\"{3}\">{2}</a> trong <a "
"href=\"{5}\">{4}</a>" "href=\"{5}\">{4}</a>"
#: judge/views/submission.py:915 #: judge/views/submission.py:921
#, python-brace-format #, python-brace-format
msgid "" msgid ""
"<a href=\"{1}\">{0}</a>'s submissions for problem {2} in <a href=\"{4}\">{3}" "<a href=\"{1}\">{0}</a>'s submissions for problem {2} in <a href=\"{4}\">{3}"
@ -3303,7 +3303,7 @@ msgstr ""
"Các bài nộp của <a href=\"{1}\">{0}</a> cho bài {2} trong <a href=\"{4}\">{3}" "Các bài nộp của <a href=\"{1}\">{0}</a> cho bài {2} trong <a href=\"{4}\">{3}"
"</a>" "</a>"
#: judge/views/submission.py:1052 #: judge/views/submission.py:1058
#, fuzzy #, fuzzy
#| msgid "You do not have the permission to rejudge submissions." #| msgid "You do not have the permission to rejudge submissions."
msgid "You don't have permission to access." msgid "You don't have permission to access."
@ -3485,7 +3485,7 @@ msgstr "Chỉnh sửa thông tin"
msgid "Rejudge" msgid "Rejudge"
msgstr "Chấm lại" msgstr "Chấm lại"
#: templates/base.html:227 templates/chat/chat.html:596 #: templates/base.html:227 templates/chat/chat.html:600
msgid "Chat" msgid "Chat"
msgstr "Chat" msgstr "Chat"
@ -3608,21 +3608,21 @@ msgstr "Sự kiện"
msgid "You have no ticket" msgid "You have no ticket"
msgstr "Bạn không có báo cáo" msgstr "Bạn không có báo cáo"
#: templates/blog/list.html:70 templates/problem/list.html:150 #: templates/blog/list.html:72 templates/problem/list.html:150
#: templates/problem/problem.html:383 #: templates/problem/problem.html:383
msgid "Clarifications" msgid "Clarifications"
msgstr "Thông báo" msgstr "Thông báo"
#: templates/blog/list.html:76 #: templates/blog/list.html:77
msgid "Add" msgid "Add"
msgstr "Thêm mới" msgstr "Thêm mới"
#: templates/blog/list.html:96 templates/problem/list.html:172 #: templates/blog/list.html:97 templates/problem/list.html:172
#: templates/problem/problem.html:394 #: templates/problem/problem.html:394
msgid "No clarifications have been made at this time." msgid "No clarifications have been made at this time."
msgstr "Không có thông báo nào." msgstr "Không có thông báo nào."
#: templates/chat/chat.html:5 templates/chat/chat.html:570 #: templates/chat/chat.html:5 templates/chat/chat.html:574
msgid "Chat Box" msgid "Chat Box"
msgstr "Chat Box" msgstr "Chat Box"
@ -3646,21 +3646,21 @@ msgstr "Tin nhắn mới"
msgid "Mute this user and delete all messages?" msgid "Mute this user and delete all messages?"
msgstr "Mute người dùng này và xóa tất cả tin nhắn chung?" msgstr "Mute người dùng này và xóa tất cả tin nhắn chung?"
#: templates/chat/chat.html:536 templates/chat/chat.html:613 #: templates/chat/chat.html:536 templates/chat/chat.html:617
#: templates/user/base-users-js.html:10 #: templates/user/base-users-js.html:10
#: templates/user/base-users-two-col.html:19 #: templates/user/base-users-two-col.html:19
msgid "Search by handle..." msgid "Search by handle..."
msgstr "Tìm kiếm theo tên..." msgstr "Tìm kiếm theo tên..."
#: templates/chat/chat.html:598 templates/chat/chat.html:605 #: templates/chat/chat.html:602 templates/chat/chat.html:609
msgid "Online Users" msgid "Online Users"
msgstr "Trực tuyến" msgstr "Trực tuyến"
#: templates/chat/chat.html:634 #: templates/chat/chat.html:638
msgid "Emoji" msgid "Emoji"
msgstr "" msgstr ""
#: templates/chat/chat.html:635 #: templates/chat/chat.html:639
msgid "Enter your message" msgid "Enter your message"
msgstr "Nhập tin nhắn" msgstr "Nhập tin nhắn"
@ -3741,13 +3741,15 @@ msgstr ""
"Bình luận bị ẩn vì nhiều phản hồi tiêu cực. Nhấp vào <a href=\"javascript:" "Bình luận bị ẩn vì nhiều phản hồi tiêu cực. Nhấp vào <a href=\"javascript:"
"comment_show_content(%(id)s)\">đây</a> để mở." "comment_show_content(%(id)s)\">đây</a> để mở."
#: templates/comments/content-list.html:109 #: templates/comments/content-list.html:111
msgid "replies" msgid "reply"
msgstr "phản hồi" msgid_plural "replies"
msgstr[0] "phản hồi"
#: templates/comments/content-list.html:129 #: templates/comments/content-list.html:136
msgid "more comments" msgid "more comment"
msgstr "bình luận nữa" msgid_plural "more comments"
msgstr[0] "bình luận nữa"
#: templates/comments/list.html:6 #: templates/comments/list.html:6
msgid "Write comment" msgid "Write comment"
@ -4584,19 +4586,19 @@ msgstr "Lưu ý thêm cho admin"
msgid "Feed" msgid "Feed"
msgstr "Gợi ý" msgstr "Gợi ý"
#: templates/problem/list-base.html:96 #: templates/problem/list-base.html:95
msgid "Filter by type..." msgid "Filter by type..."
msgstr "Lọc theo dạng..." msgstr "Lọc theo dạng..."
#: templates/problem/list-base.html:159 templates/problem/list-base.html:185 #: templates/problem/list-base.html:158 templates/problem/list-base.html:184
msgid "Add types..." msgid "Add types..."
msgstr "Thêm dạng" msgstr "Thêm dạng"
#: templates/problem/list-base.html:201 #: templates/problem/list-base.html:200
msgid "Fail to vote!" msgid "Fail to vote!"
msgstr "Hệ thống lỗi!" msgstr "Hệ thống lỗi!"
#: templates/problem/list-base.html:204 #: templates/problem/list-base.html:203
msgid "Successful vote! Thank you!" msgid "Successful vote! Thank you!"
msgstr "Đã gửi thành công! Cảm ơn bạn!" msgstr "Đã gửi thành công! Cảm ơn bạn!"
@ -4891,11 +4893,11 @@ msgstr "Lọc"
msgid "Random" msgid "Random"
msgstr "Ngẫu nhiên" msgstr "Ngẫu nhiên"
#: templates/problem/submit.html:123 #: templates/problem/submit.html:124
msgid "Your source code must contain at most 65536 characters." msgid "Your source code must contain at most 65536 characters."
msgstr "Code phải chứa không quá 65536 ký tự." msgstr "Code phải chứa không quá 65536 ký tự."
#: templates/problem/submit.html:170 #: templates/problem/submit.html:171
#, python-format #, python-format
msgid "" msgid ""
"<b>Warning!</b> Your default language, <b>%(default_language)s</b>, is " "<b>Warning!</b> Your default language, <b>%(default_language)s</b>, is "
@ -4904,7 +4906,7 @@ msgstr ""
"<b>Cẩn thận!</b> Ngôn ngữ ưa thích của bạn, <b>%(default_language)s</b>, " "<b>Cẩn thận!</b> Ngôn ngữ ưa thích của bạn, <b>%(default_language)s</b>, "
"không được sử dụng trong bài này." "không được sử dụng trong bài này."
#: templates/problem/submit.html:181 #: templates/problem/submit.html:182
#, fuzzy, python-format #, fuzzy, python-format
#| msgid "" #| msgid ""
#| "\n" #| "\n"
@ -4927,15 +4929,15 @@ msgstr[0] ""
" Bạn còn %(left)s lần nộp\n" " Bạn còn %(left)s lần nộp\n"
" " " "
#: templates/problem/submit.html:190 #: templates/problem/submit.html:191
msgid "You have 0 submissions left" msgid "You have 0 submissions left"
msgstr "Bạn đã hết lần nộp" msgstr "Bạn đã hết lần nộp"
#: templates/problem/submit.html:224 #: templates/problem/submit.html:225
msgid "No judge is available for this problem." msgid "No judge is available for this problem."
msgstr "Không có máy chấm có thể chấm bài này." msgstr "Không có máy chấm có thể chấm bài này."
#: templates/problem/submit.html:230 #: templates/problem/submit.html:231
msgid "Submit!" msgid "Submit!"
msgstr "Nộp bài!" msgstr "Nộp bài!"
@ -5731,7 +5733,7 @@ msgstr "Thông tin"
msgid "Check all" msgid "Check all"
msgstr "Chọn tất cả" msgstr "Chọn tất cả"
#~ msgid "reply" #~ msgid "replies"
#~ msgstr "phản hồi" #~ msgstr "phản hồi"
#~ msgid "comment more" #~ msgid "comment more"

View file

@ -2,53 +2,53 @@
{% set profile = request.profile if logged_in else None %} {% set profile = request.profile if logged_in else None %}
{% for node in mptt_tree(comment_list) recursive %} {% for node in mptt_tree(comment_list) recursive %}
<li id="comment-{{ node.id }}" data-revision="{{ node.revisions - 1 }}" data-max-revision="{{ node.revisions - 1 }}" <li id="comment-{{ node.id }}" data-revision="{{ node.revisions - 1 }}" data-max-revision="{{ node.revisions - 1 }}"
data-revision-ajax="{{ url('comment_revision_ajax', node.id) }}" class="comment"> data-revision-ajax="{{ url('comment_revision_ajax', node.id) }}" class="comment">
<div class="comment-display{% if node.score <= vote_hide_threshold %} bad-comment{% endif %}"> <div class="comment-display{% if node.score <= vote_hide_threshold %} bad-comment{% endif %}">
<div class="info"> <div class="info">
<div class="vote"> <div class="vote">
{% if logged_in %} {% if logged_in %}
<a href="javascript:comment_upvote({{ node.id }})" <a href="javascript:comment_upvote({{ node.id }})"
class="upvote-link fa fa-chevron-up fa-fw{% if node.vote_score == 1 %} voted{% endif %}"></a> class="upvote-link fa fa-chevron-up fa-fw{% if node.vote_score == 1 %} voted{% endif %}"></a>
{% else %}
<a href="javascript:alert('{{ _('Please login to vote')|escapejs }}')"
title="{{ _('Please login to vote') }}" class="upvote-link fa fa-chevron-up fa-fw"></a>
{% endif %}
<br>
<div class="comment-score">{{ node.score }}</div>
{% if logged_in %}
<a href="javascript:comment_downvote({{ node.id }})"
class="downvote-link fa fa-chevron-down fa-fw{% if node.vote_score == -1 %} voted{% endif %}"></a>
{% else %} {% else %}
<a href="javascript:alert('{{ _('Please login to vote')|escapejs }}')" <a href="javascript:alert('{{ _('Please login to vote')|escapejs }}')"
title="{{ _('Please login to vote') }}" class="downvote-link fa fa-chevron-down fa-fw"></a> title="{{ _('Please login to vote') }}" class="upvote-link fa fa-chevron-up fa-fw"></a>
{% endif %} {% endif %}
<br>
<div class="comment-score">{{ node.score }}</div>
{% if logged_in %}
<a href="javascript:comment_downvote({{ node.id }})"
class="downvote-link fa fa-chevron-down fa-fw{% if node.vote_score == -1 %} voted{% endif %}"></a>
{% else %}
<a href="javascript:alert('{{ _('Please login to vote')|escapejs }}')"
title="{{ _('Please login to vote') }}" class="downvote-link fa fa-chevron-down fa-fw"></a>
{% endif %}
</div>
</div> </div>
</div> <div class="detail">
<div class="detail"> <div class="header">
<div class="header"> {% with author=node.author, user=node.author.user %}
{% with author=node.author, user=node.author.user %} <a href="{{ url('user_page', user.username) }}" class="user comment-img">
<a href="{{ url('user_page', user.username) }}" class="user comment-img"> <img src="{{ gravatar(author, 135) }}" class="gravatar">
<img src="{{ gravatar(author, 135) }}" class="gravatar"> </a>
</a> {% endwith %}
{% endwith %} {{ link_user(node.author) }},&nbsp;
{{ link_user(node.author) }},&nbsp; {{ relative_time(node.time, abs=_('{time}'), rel=_('{time}')) }}
{{ relative_time(node.time, abs=_('{time}'), rel=_('{time}')) }} <span class="comment-spacer"></span>
<span class="comment-spacer"></span> <span class="comment-operation">
<span class="comment-operation"> {% if node.revisions > 1 %}
{% if node.revisions > 1 %} <span class="comment-edits">
<span class="comment-edits"> <a href="javascript:show_revision({{ node.id }}, -1)" class="previous-revision">&larr;</a>
<a href="javascript:show_revision({{ node.id }}, -1)" class="previous-revision">&larr;</a> <span class="comment-edit-text">
<span class="comment-edit-text"> {% if node.revisions > 2 %}
{% if node.revisions > 2 %} {% trans edits=node.revisions - 1 %}edit {{ edits }}{% endtrans %}
{% trans edits=node.revisions - 1 %}edit {{ edits }}{% endtrans %} {% else %}
{% else %} {{ _('edited') }}
{{ _('edited') }} {% endif %}
{% endif %} </span>
<a href="javascript:show_revision({{ node.id }}, 1)" style="visibility: hidden"
class="next-revision">&rarr;</a>
</span> </span>
<a href="javascript:show_revision({{ node.id }}, 1)" style="visibility: hidden"
class="next-revision">&rarr;</a>
</span>
{% else %} {% else %}
<span class="comment-edits"></span> <span class="comment-edits"></span>
{% endif %} {% endif %}
@ -63,54 +63,60 @@
<i class="fa fa-pencil fa-fw"></i> <i class="fa fa-pencil fa-fw"></i>
</a> </a>
{% else %} {% else %}
<a href="javascript:reply_comment({{ node.id }})" title="{{ _('Reply') }}"> <a href="javascript:reply_comment({{ node.id }})" title="{{ _('Reply') }}">
<i class="fa fa-reply fa-fw"></i> <i class="fa fa-reply fa-fw"></i>
</a> </a>
{% endif %}
{% if perms.judge.change_comment %}
{% if can_edit %}
<a href="javascript:reply_comment({{ node.id }})" title="{{ _('Reply') }}"><i
class="fa fa-reply fa-fw"></i></a>
{% else %}
<a data-featherlight="{{ url('comment_edit_ajax', node.id) }}"
href="{{ url('comment_edit', node.id) }}" title="{{ _('Edit') }}" class="edit-link"><i
class="fa fa-pencil fa-fw"></i></a>
{% endif %} {% endif %}
<a href="javascript:" title="{{ _('Hide') }}" data-id="{{ node.id }}" class="hide-comment"><i {% if perms.judge.change_comment %}
{% if can_edit %}
<a href="javascript:reply_comment({{ node.id }})" title="{{ _('Reply') }}"><i
class="fa fa-reply fa-fw"></i></a>
{% else %}
<a data-featherlight="{{ url('comment_edit_ajax', node.id) }}"
href="{{ url('comment_edit', node.id) }}" title="{{ _('Edit') }}" class="edit-link"><i
class="fa fa-pencil fa-fw"></i></a>
{% endif %}
<a href="javascript:" title="{{ _('Hide') }}" data-id="{{ node.id }}" class="hide-comment"><i
class="fa fa-trash fa-fw"></i></a> class="fa fa-trash fa-fw"></i></a>
<a href="{{ url('admin:judge_comment_change', node.id) }}" title="{{ _('Admin') }}"><i <a href="{{ url('admin:judge_comment_change', node.id) }}" title="{{ _('Admin') }}"><i
class="fa fa-cog fa-fw"></i></a> class="fa fa-cog fa-fw"></i></a>
{% endif %}
{% endif %} {% endif %}
{% endif %} </span>
</span>
</div>
<div class="content content-description">
<div class="comment-body" {% if node.score <=vote_hide_threshold %} style="display:none" {% endif %}>
{{ node.body|markdown(lazy_load=True)|reference|str|safe }}
</div> </div>
{% if node.score <= vote_hide_threshold %} <div class="content content-description">
<div class="comment-body bad-comment-body"> <div class="comment-body" {% if node.score <=vote_hide_threshold %} style="display:none" {% endif %}>
<p> {{ node.body|markdown(lazy_load=True)|reference|str|safe }}
{% trans id=node.id %}This comment is hidden due to too much negative feedback. Click <a
href="javascript:comment_show_content({{ id }})">here</a> to view it.{% endtrans %}
</p>
</div> </div>
{% endif %} {% if node.score <= vote_hide_threshold %}
<div class="comment-body bad-comment-body">
<p>
{% trans id=node.id %}This comment is hidden due to too much negative feedback. Click <a
href="javascript:comment_show_content({{ id }})">here</a> to view it.{% endtrans %}
</p>
</div>
{% endif %}
</div>
</div> </div>
</div> </div>
</div>
{% if node.count_replies %} {% set count_replies=node.count_replies %}
<a href="javascript:comment_get_replies({{ node.id }}, 0)" class="show_more_reply"> {% if count_replies %}
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-arrow-forward" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <a href="javascript:comment_get_replies({{ node.id }}, 0)" class="show_more_reply">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-arrow-forward" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path d="M15 11l4 4l-4 4m4 -4h-11a4 4 0 0 1 0 -8h1"></path> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
</svg> <path d="M15 11l4 4l-4 4m4 -4h-11a4 4 0 0 1 0 -8h1"></path>
{{ node.count_replies }} {{ _('replies') if node.count_replies > 1 else _('reply') }} </svg>
</a> {{ count_replies }}
{% endif %} {% trans trimmed count=count_replies %}
</li> reply
<ul id="comment-{{ node.id }}-reply" class="reply-comment" hidden></ul> {% pluralize count %}
replies
{% endtrans %}
</a>
{% endif %}
</li>
<ul id="comment-{{ node.id }}-reply" class="reply-comment" hidden></ul>
{% with children=node.get_children() %} {% with children=node.get_children() %}
{% if children %} {% if children %}
<ul id="comment-{{ node.id }}-children" class="comments">{{ loop(children) }}</ul> <ul id="comment-{{ node.id }}-children" class="comments">{{ loop(children) }}</ul>
@ -125,7 +131,12 @@
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-down" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-down" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M6 9l6 6l6 -6"></path> <path d="M6 9l6 6l6 -6"></path>
</svg> </svg>
{{ comment_more }} {{ _('more comments') if comment_more > 1 else _('more comment') }} {{ comment_more }}
{% trans trimmed count=comment_more %}
more comment
{% pluralize count %}
more comments
{% endtrans %}
</a> </a>
{% endif %} {% endif %}

View file

@ -30,6 +30,7 @@
{% endif %} {% endif %}
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
let loading_gif = "<img src=\"{{static('loading.gif')}}\" style=\"height: 1.5em; margin-bottom: 3px\" class=\"loading\">";
window.reply_comment = function (parent) { window.reply_comment = function (parent) {
var $comment_reply = $('#comment-' + parent + '-reply'); var $comment_reply = $('#comment-' + parent + '-reply');
var reply_id = 'reply-' + parent; var reply_id = 'reply-' + parent;
@ -127,7 +128,7 @@
var $comment_show_btn = $("#comment-" + id + " .show_more_reply"); var $comment_show_btn = $("#comment-" + id + " .show_more_reply");
$comment_show_btn.hide(); $comment_show_btn.hide();
var $comment = $("#comment-" + id + "-children"); var $comment = $("#comment-" + id + "-children");
$comment.append("<p class='loading'> Loading... </p>"); $comment.append(loading_gif);
ajax_get_reply('{{ url('comment_get_replies') }}', id, parent_none); ajax_get_reply('{{ url('comment_get_replies') }}', id, parent_none);
} }
@ -153,12 +154,12 @@
var $comment_show_btn = $("#comment-0" + " .show_more_comment"); var $comment_show_btn = $("#comment-0" + " .show_more_comment");
$comment_show_btn.hide(); $comment_show_btn.hide();
var $comment = $("#comment-0"); var $comment = $("#comment-0");
$comment.append("<p class='loading'> Loading... </p>"); $comment.append(loading_gif);
} else { } else {
var $comment_show_btn = $("#comment-" + id + "-children" + " .show_more_comment"); var $comment_show_btn = $("#comment-" + id + "-children" + " .show_more_comment");
$comment_show_btn.hide(); $comment_show_btn.hide();
var $comment = $("#comment-" + id + "-children"); var $comment = $("#comment-" + id + "-children");
$comment.append("<p class='loading'> Loading... </p>"); $comment.append(loading_gif);
} }
ajax_comment_show_more('{{ url('comment_show_more') }}', id, parent_none, offset, target_comment); ajax_comment_show_more('{{ url('comment_show_more') }}', id, parent_none, offset, target_comment);
} }