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,11 +62,11 @@ class CreateInteractionReportForm(forms.Form):
62 def clean_init_date(self): 62 def clean_init_date(self):
63 init_date = self.cleaned_data['init_date'] 63 init_date = self.cleaned_data['init_date']
64 if init_date < self.subject.init_date: 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 return init_date 66 return init_date
67 67
68 def clean_end_date(self): 68 def clean_end_date(self):
69 end_date = self.cleaned_data['end_date'] 69 end_date = self.cleaned_data['end_date']
70 if end_date > self.subject.end_date: 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 return end_date 72 return end_date
73 \ No newline at end of file 73 \ No newline at end of file
reports/locale/pt_BR/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid &quot;&quot; @@ -8,7 +8,7 @@ msgid &quot;&quot;
8 msgstr "" 8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n" 9 "Project-Id-Version: PACKAGE VERSION\n"
10 "Report-Msgid-Bugs-To: \n" 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 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 "Language-Team: LANGUAGE <LL@li.org>\n" 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,26 +55,26 @@ msgid &quot;The initial date can&#39;t be after the end one.&quot;
55 msgstr "A data inicial não pode ser depois da final" 55 msgstr "A data inicial não pode ser depois da final"
56 56
57 #: .\forms.py:65 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 #: .\forms.py:71 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 msgid "General Parameters" 66 msgid "General Parameters"
67 msgstr "Escolha o Tópico e o Período" 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 msgid "Choose the Data Source (is possible to pick more than one)" 70 msgid "Choose the Data Source (is possible to pick more than one)"
71 msgstr "Escolha a fonte de dados (é possível escolher mais de uma)" 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 msgid "Interaction with resources" 74 msgid "Interaction with resources"
75 msgstr "Interação com recursos" 75 msgstr "Interação com recursos"
76 76
77 -#: .\templates\reports\_form.html:97 77 +#: .\templates\reports\_form.html:110
78 msgid "Search Report" 78 msgid "Search Report"
79 msgstr "Buscar" 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,23 +144,33 @@ msgstr &quot;Número de postagens de dúvidas criadas no mural da disciplina.&quot;
144 144
145 #: .\views.py:251 145 #: .\views.py:251
146 msgid "Amount of comments on help posts created by the student." 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 #: .\views.py:256 151 #: .\views.py:256
150 msgid "Amount of comments made by the student on teachers help posts." 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 #: .\views.py:260 157 #: .\views.py:260
154 msgid "Amount of comments made by the student on other students help posts." 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 #: .\views.py:271 163 #: .\views.py:271
158 msgid "Number of help posts created by the user that the teacher commented on." 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 #: .\views.py:279 169 #: .\views.py:279
162 msgid "Number of help posts created by the user others students commented on." 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 #: .\views.py:282 175 #: .\views.py:282
166 msgid "Number of student visualizations on the mural of the subject." 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,19 +178,23 @@ msgstr &quot;Número de visualizações do mural da disciplina.&quot;
168 178
169 #: .\views.py:303 179 #: .\views.py:303
170 msgid "Number of access to mural between 6 a.m to 12a.m. ." 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 #: .\views.py:307 184 #: .\views.py:307
174 msgid "Number of access to mural between 0 p.m to 6p.m. ." 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 #: .\views.py:310 189 #: .\views.py:310
178 msgid "Number of access to mural between 6 p.m to 12p.m. ." 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 #: .\views.py:314 194 #: .\views.py:314
182 msgid "Number of access to mural between 0 a.m to 6a.m. ." 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 #: .\views.py:319 199 #: .\views.py:319
186 msgid "sunday" 200 msgid "sunday"
reports/templates/reports/_form.html
@@ -23,12 +23,10 @@ @@ -23,12 +23,10 @@
23 <span aria-hidden="true">&times;</span> 23 <span aria-hidden="true">&times;</span>
24 </button> 24 </button>
25 <ul> 25 <ul>
26 -  
27 <li>{{error}}</li> 26 <li>{{error}}</li>
28 -  
29 </ul> 27 </ul>
30 </div> 28 </div>
31 - {% endfor %} 29 + {% endfor %}
32 30
33 {% endfor %} 31 {% endfor %}
34 <h5 class="one"> <span>{% trans "General Parameters" %}</span></h5> 32 <h5 class="one"> <span>{% trans "General Parameters" %}</span></h5>
reports/views.py
@@ -129,9 +129,6 @@ class ReportView(LoginRequiredMixin, generic.FormView): @@ -129,9 +129,6 @@ class ReportView(LoginRequiredMixin, generic.FormView):
129 self.formset_data = resources_formset.cleaned_data 129 self.formset_data = resources_formset.cleaned_data
130 return self.form_valid(form) 130 return self.form_valid(form)
131 else: 131 else:
132 - for field in form:  
133 - for error in field.errors:  
134 - print(error)  
135 return self.form_invalid(form) 132 return self.form_invalid(form)
136 133
137 134