Commit 8baad86a2ad7fac306ab738757c581f785b6edff

Authored by Felipe Bormann
1 parent 72e99342

fixed translation error in forms.py from reports app, translating messages correctly now

reports/forms.py
... ... @@ -62,11 +62,11 @@ class CreateInteractionReportForm(forms.Form):
62 62 def clean_init_date(self):
63 63 init_date = self.cleaned_data['init_date']
64 64 if init_date < self.subject.init_date:
65   - self._errors['init_date'] = [_('This date should be right or after ' + str(self.subject.init_date) + ', which is when the subject started. ')]
  65 + self._errors['init_date'] = [_('This date should be right or after %s, which is when the subject started. ') % str(self.subject.init_date)]
66 66 return init_date
67 67  
68 68 def clean_end_date(self):
69 69 end_date = self.cleaned_data['end_date']
70 70 if end_date > self.subject.end_date:
71   - self._errors['end_date'] = [_('This date should be right or before ' + str(self.subject.end_date) + ', which is when the subject finishes. ')]
  71 + self._errors['end_date'] = [_('This date should be right or before %s, which is when the subject finishes. ') % str(self.subject.end_date)]
72 72 return end_date
73 73 \ No newline at end of file
... ...
reports/locale/pt_BR/LC_MESSAGES/django.po
... ... @@ -8,7 +8,7 @@ msgid &quot;&quot;
8 8 msgstr ""
9 9 "Project-Id-Version: PACKAGE VERSION\n"
10 10 "Report-Msgid-Bugs-To: \n"
11   -"POT-Creation-Date: 2017-04-29 21:14-0300\n"
  11 +"POT-Creation-Date: 2017-05-21 19:45-0300\n"
12 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 14 "Language-Team: LANGUAGE <LL@li.org>\n"
... ... @@ -55,26 +55,26 @@ msgid &quot;The initial date can&#39;t be after the end one.&quot;
55 55 msgstr "A data inicial não pode ser depois da final"
56 56  
57 57 #: .\forms.py:65
58   -msgid "This date should be right or after "
59   -msgstr "Esta data deve ser igual ou após"
  58 +msgid "This date should be right or after %s, which is when the subject started. "
  59 +msgstr "Esta data deve ser igual ou após %s, pois é quando o assunto começa."
60 60  
61 61 #: .\forms.py:71
62   -msgid "This date should be right or before "
63   -msgstr "Esta data deve ser igual ou anterior à"
  62 +msgid "This date should be right or before %s, which is when the subject finishes. "
  63 +msgstr "Esta data deve ser igual ou anterior à %s, pois é quando o assunto termina."
64 64  
65   -#: .\templates\reports\_form.html:19
  65 +#: .\templates\reports\_form.html:32
66 66 msgid "General Parameters"
67 67 msgstr "Escolha o Tópico e o Período"
68 68  
69   -#: .\templates\reports\_form.html:37
  69 +#: .\templates\reports\_form.html:50
70 70 msgid "Choose the Data Source (is possible to pick more than one)"
71 71 msgstr "Escolha a fonte de dados (é possível escolher mais de uma)"
72 72  
73   -#: .\templates\reports\_form.html:62
  73 +#: .\templates\reports\_form.html:75
74 74 msgid "Interaction with resources"
75 75 msgstr "Interação com recursos"
76 76  
77   -#: .\templates\reports\_form.html:97
  77 +#: .\templates\reports\_form.html:110
78 78 msgid "Search Report"
79 79 msgstr "Buscar"
80 80  
... ... @@ -144,23 +144,33 @@ msgstr &quot;Número de postagens de dúvidas criadas no mural da disciplina.&quot;
144 144  
145 145 #: .\views.py:251
146 146 msgid "Amount of comments on help posts created by the student."
147   -msgstr "Número de comentários criados para as próprias postagens de dúvidas no mural da disciplina."
  147 +msgstr ""
  148 +"Número de comentários criados para as próprias postagens de dúvidas no mural "
  149 +"da disciplina."
148 150  
149 151 #: .\views.py:256
150 152 msgid "Amount of comments made by the student on teachers help posts."
151   -msgstr "Número de comentários às postagens de dúvidas no mural da disciplina criadas pelo professor."
  153 +msgstr ""
  154 +"Número de comentários às postagens de dúvidas no mural da disciplina criadas "
  155 +"pelo professor."
152 156  
153 157 #: .\views.py:260
154 158 msgid "Amount of comments made by the student on other students help posts."
155   -msgstr "Número de comentários às postagens de dúvidas no mural da disciplina criadas por outros estudantes."
  159 +msgstr ""
  160 +"Número de comentários às postagens de dúvidas no mural da disciplina criadas "
  161 +"por outros estudantes."
156 162  
157 163 #: .\views.py:271
158 164 msgid "Number of help posts created by the user that the teacher commented on."
159   -msgstr "Número de comentários às postagens de dúvidas no mural da disciplina criadas por outros estudantes"
  165 +msgstr ""
  166 +"Número de comentários às postagens de dúvidas no mural da disciplina criadas "
  167 +"por outros estudantes"
160 168  
161 169 #: .\views.py:279
162 170 msgid "Number of help posts created by the user others students commented on."
163   -msgstr "Número de postagens de dúvidas criadas no mural da disciplina que foram comentadas por outros estudantes."
  171 +msgstr ""
  172 +"Número de postagens de dúvidas criadas no mural da disciplina que foram "
  173 +"comentadas por outros estudantes."
164 174  
165 175 #: .\views.py:282
166 176 msgid "Number of student visualizations on the mural of the subject."
... ... @@ -168,19 +178,23 @@ msgstr &quot;Número de visualizações do mural da disciplina.&quot;
168 178  
169 179 #: .\views.py:303
170 180 msgid "Number of access to mural between 6 a.m to 12a.m. ."
171   -msgstr "Número de acessos ao ambiente virtual da disciplina no horário de 06h às 12h."
  181 +msgstr ""
  182 +"Número de acessos ao ambiente virtual da disciplina no horário de 06h às 12h."
172 183  
173 184 #: .\views.py:307
174 185 msgid "Number of access to mural between 0 p.m to 6p.m. ."
175   -msgstr "Número de acessos ao ambiente virtual da disciplina no horário de 12h às 18h."
  186 +msgstr ""
  187 +"Número de acessos ao ambiente virtual da disciplina no horário de 12h às 18h."
176 188  
177 189 #: .\views.py:310
178 190 msgid "Number of access to mural between 6 p.m to 12p.m. ."
179   -msgstr "Número de acessos ao ambiente virtual da disciplina no horário de 18h às 24h."
  191 +msgstr ""
  192 +"Número de acessos ao ambiente virtual da disciplina no horário de 18h às 24h."
180 193  
181 194 #: .\views.py:314
182 195 msgid "Number of access to mural between 0 a.m to 6a.m. ."
183   -msgstr "Número de acessos ao ambiente virtual da disciplina no horário de 24h às 06h."
  196 +msgstr ""
  197 +"Número de acessos ao ambiente virtual da disciplina no horário de 24h às 06h."
184 198  
185 199 #: .\views.py:319
186 200 msgid "sunday"
... ...
reports/templates/reports/_form.html
... ... @@ -23,12 +23,10 @@
23 23 <span aria-hidden="true">&times;</span>
24 24 </button>
25 25 <ul>
26   -
27 26 <li>{{error}}</li>
28   -
29 27 </ul>
30 28 </div>
31   - {% endfor %}
  29 + {% endfor %}
32 30  
33 31 {% endfor %}
34 32 <h5 class="one"> <span>{% trans "General Parameters" %}</span></h5>
... ...
reports/views.py
... ... @@ -129,9 +129,6 @@ class ReportView(LoginRequiredMixin, generic.FormView):
129 129 self.formset_data = resources_formset.cleaned_data
130 130 return self.form_valid(form)
131 131 else:
132   - for field in form:
133   - for error in field.errors:
134   - print(error)
135 132 return self.form_invalid(form)
136 133  
137 134  
... ...