Revised the error messages and their translations both in Python and for the JavaScript.

This commit is contained in:
依瑪貓 2020-08-06 01:47:01 +08:00
parent b45c06ac36
commit 1d79e970c4
5 changed files with 39 additions and 34 deletions

View File

@ -49,7 +49,7 @@ class RecordForm(forms.Form):
required=False, required=False,
max_length=128, max_length=128,
error_messages={ error_messages={
"max_length": _("This summary is too long."), "max_length": _("This summary is too long (max. 128 characters)."),
}) })
amount = forms.IntegerField( amount = forms.IntegerField(
min_value=1, min_value=1,
@ -181,13 +181,14 @@ class TransactionForm(forms.Form):
date = forms.DateField( date = forms.DateField(
required=True, required=True,
error_messages={ error_messages={
"required": _("Please fill in the date."),
"invalid": _("This date is not valid.") "invalid": _("This date is not valid.")
}) })
notes = forms.CharField( notes = forms.CharField(
required=False, required=False,
max_length=128, max_length=128,
error_messages={ error_messages={
"max_length": _("This notes is too long.") "max_length": _("These notes are too long (max. 128 characters).")
}) })
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@ -5,16 +5,17 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: mia 1.0\n" "Project-Id-Version: mia-js 1.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: imacat <imacat@mail.imacat.idv.tw>\n"
"POT-Creation-Date: 2020-08-06 00:48+0800\n" "POT-Creation-Date: 2020-08-06 01:42+0800\n"
"PO-Revision-Date: 2020-08-06 00:40+0800\n" "PO-Revision-Date: 2020-08-06 01:46+0800\n"
"Last-Translator: imacat <imacat@mail.imacat.idv.tw>\n" "Last-Translator: imacat <imacat@mail.imacat.idv.tw>\n"
"Language-Team: Traditional Chinese <imacat@mail.imacat.idv.tw>\n" "Language-Team: Traditional Chinese <imacat@mail.imacat.idv.tw>\n"
"Language: Traditional Chinese\n" "Language: Traditional Chinese\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: accounting/converters.py:127 accounting/utils.py:261 #: accounting/converters.py:127 accounting/utils.py:261
msgid "current assets and liabilities" msgid "current assets and liabilities"
@ -29,8 +30,8 @@ msgid "Please select the account."
msgstr "請選擇會計科目。" msgstr "請選擇會計科目。"
#: accounting/forms.py:52 #: accounting/forms.py:52
msgid "This summary is too long." msgid "This summary is too long (max. 128 characters)."
msgstr "摘要太長了。" msgstr "摘要太長了最長128個字。"
#: accounting/forms.py:57 #: accounting/forms.py:57
msgid "Please fill in the amount." msgid "Please fill in the amount."
@ -65,14 +66,18 @@ msgid "This record is not a debit record."
msgstr "這不是借方的會計記錄。" msgstr "這不是借方的會計記錄。"
#: accounting/forms.py:184 #: accounting/forms.py:184
msgid "Please fill in the date."
msgstr "請填寫日期。"
#: accounting/forms.py:185
msgid "This date is not valid." msgid "This date is not valid."
msgstr "請依正確日期格式填寫日期。" msgstr "請依正確日期格式填寫日期。"
#: accounting/forms.py:190 #: accounting/forms.py:191
msgid "This notes is too long." msgid "These notes are too long (max. 128 characters)."
msgstr "註記太長了。" msgstr "註記太長了最長128個字。"
#: accounting/forms.py:220 #: accounting/forms.py:221
msgid "The total amount of debit and credit records are inconsistent." msgid "The total amount of debit and credit records are inconsistent."
msgstr "借方和貸方合計不符。" msgstr "借方和貸方合計不符。"

View File

@ -1,18 +1,17 @@
# SOME DESCRIPTIVE TITLE. # Traditional Chinese PO file for the JavaScript on the Mia Website
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # Copyright (C) 2020 imacat
# This file is distributed under the same license as the PACKAGE package. # This file is distributed under the same license as the Mia package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # imacat <imacat@mail.imacat.idv.tw>, 2020.
# #
#, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: mia 1.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: imacat <imacat@mail.imacat.idv.tw>\n"
"POT-Creation-Date: 2020-08-06 01:34+0800\n" "POT-Creation-Date: 2020-08-06 01:42+0800\n"
"PO-Revision-Date: 2020-08-06 01:38+0800\n" "PO-Revision-Date: 2020-08-06 01:46+0800\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: imacat <imacat@mail.imacat.idv.tw>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: Traditional Chinese <imacat@mail.imacat.idv.tw>\n"
"Language: \n" "Language: Traditional Chinese\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
@ -20,7 +19,7 @@ msgstr ""
#: accounting/static/accounting/js/transaction-form.js:369 #: accounting/static/accounting/js/transaction-form.js:369
msgid "Please fill in the date." msgid "Please fill in the date."
msgstr "請填日期。" msgstr "請填日期。"
#: accounting/static/accounting/js/transaction-form.js:389 #: accounting/static/accounting/js/transaction-form.js:389
msgid "Please select the account." msgid "Please select the account."
@ -32,12 +31,12 @@ msgstr "摘要太長了最長128個字。"
#: accounting/static/accounting/js/transaction-form.js:431 #: accounting/static/accounting/js/transaction-form.js:431
msgid "Please fill in the amount." msgid "Please fill in the amount."
msgstr "請填金額。" msgstr "請填金額。"
#: accounting/static/accounting/js/transaction-form.js:463 #: accounting/static/accounting/js/transaction-form.js:463
msgid "The total amount of debit and credit records are inconsistent." msgid "The total amount of debit and credit records are inconsistent."
msgstr "借方和貸方合計不符。" msgstr "借方和貸方合計不符。"
#: accounting/static/accounting/js/transaction-form.js:484 #: accounting/static/accounting/js/transaction-form.js:484
msgid "This note is too long (max. 128 characters)." msgid "These notes are too long (max. 128 characters)."
msgstr "註記太長了最長128個字。" msgstr "註記太長了最長128個字。"

View File

@ -481,7 +481,7 @@ function validateNote() {
note.value = note.value.trim(); note.value = note.value.trim();
if (note.value.length > 128) { if (note.value.length > 128) {
note.classList.add("is-invalid"); note.classList.add("is-invalid");
errorMessage.text(gettext("This note is too long (max. 128 characters).")); errorMessage.text(gettext("These notes are too long (max. 128 characters)."));
return false; return false;
} }
note.classList.remove("is-invalid"); note.classList.remove("is-invalid");

View File

@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: mia 1.0\n" "Project-Id-Version: mia 1.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-06 00:48+0800\n" "POT-Creation-Date: 2020-08-06 01:42+0800\n"
"PO-Revision-Date: 2020-08-06 00:40+0800\n" "PO-Revision-Date: 2020-08-06 01:46+0800\n"
"Last-Translator: imacat <imacat@mail.imacat.idv.tw>\n" "Last-Translator: imacat <imacat@mail.imacat.idv.tw>\n"
"Language-Team: Traditional Chinese <imacat@mail.imacat.idv.tw>\n" "Language-Team: Traditional Chinese <imacat@mail.imacat.idv.tw>\n"
"Language: Traditional Chinese\n" "Language: Traditional Chinese\n"
@ -37,11 +37,11 @@ msgid "All Time"
msgstr "全部" msgstr "全部"
#: mia_core/period.py:583 mia_core/period.py:616 #: mia_core/period.py:583 mia_core/period.py:616
#: mia_core/templatetags/mia_core.py:212 #: mia_core/templatetags/mia_core.py:213
msgid "This Month" msgid "This Month"
msgstr "這個月" msgstr "這個月"
#: mia_core/period.py:624 mia_core/templatetags/mia_core.py:219 #: mia_core/period.py:624 mia_core/templatetags/mia_core.py:220
msgid "Last Month" msgid "Last Month"
msgstr "上個月" msgstr "上個月"
@ -53,11 +53,11 @@ msgstr "今年"
msgid "Last Year" msgid "Last Year"
msgstr "去年" msgstr "去年"
#: mia_core/period.py:656 mia_core/templatetags/mia_core.py:192 #: mia_core/period.py:656 mia_core/templatetags/mia_core.py:193
msgid "Today" msgid "Today"
msgstr "今天" msgstr "今天"
#: mia_core/period.py:658 mia_core/templatetags/mia_core.py:194 #: mia_core/period.py:658 mia_core/templatetags/mia_core.py:195
msgid "Yesterday" msgid "Yesterday"
msgstr "昨天" msgstr "昨天"