-
Notifications
You must be signed in to change notification settings - Fork 0
/
exercise-translations
56 lines (50 loc) · 2.3 KB
/
exercise-translations
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# HG changeset patch
# Parent 7c95aad3b60e4c2006c5f706bd157e8e05318bfa
diff --git a/openacademy/models.py b/openacademy/models.py
--- a/openacademy/models.py
+++ b/openacademy/models.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from datetime import timedelta
-from odoo import models, fields, api, exceptions
+from odoo import models, fields, api, exceptions, _
class Course(models.Model):
_name = 'openacademy.course'
@@ -20,11 +20,11 @@ class Course(models.Model):
default = dict(default or {})
copied_count = self.search_count(
- [('name', '=like', u"Copy of {}%".format(self.name))])
+ [('name', '=like', _(u"Copy of {}%").format(self.name))])
if not copied_count:
- new_name = u"Copy of {}".format(self.name)
+ new_name = _(u"Copy of {}").format(self.name)
else:
- new_name = u"Copy of {} ({})".format(self.name, copied_count)
+ new_name = _(u"Copy of {} ({})").format(self.name, copied_count)
default['name'] = new_name
return super(Course, self).copy(default)
@@ -81,15 +81,15 @@ class Session(models.Model):
if self.seats < 0:
return {
'warning': {
- 'title': "Incorrect 'seats' value",
- 'message': "The number of available seats may not be negative",
+ 'title': _("Incorrect 'seats' value"),
+ 'message': _("The number of available seats may not be negative"),
},
}
if self.seats < len(self.attendee_ids):
return {
'warning': {
- 'title': "Too many attendees",
- 'message': "Increase seats or remove excess attendees",
+ 'title': _("Too many attendees"),
+ 'message': _("Increase seats or remove excess attendees"),
},
}
@@ -114,4 +114,4 @@ class Session(models.Model):
def _check_instructor_not_in_attendees(self):
for r in self:
if r.instructor_id and r.instructor_id in r.attendee_ids:
- raise exceptions.ValidationError("A session's instructor can't be an attendee")
+ raise exceptions.ValidationError(_("A session's instructor can't be an attendee"))