Skip to content

Commit 464af5d

Browse files
committed
Add i18n to error msg
1 parent fbc7158 commit 464af5d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

readthedocs/api/v3/serializers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -569,19 +569,19 @@ def validate_child(self, value):
569569
user = self.context['request'].user
570570
if user not in value.users.all():
571571
raise serializers.ValidationError(
572-
'You do not have permissions on the child project',
572+
_('You do not have permissions on the child project'),
573573
)
574574

575575
# Check the child project is not a subproject already
576576
if value.superprojects.exists():
577577
raise serializers.ValidationError(
578-
'Child is already a subproject of another project',
578+
_('Child is already a subproject of another project'),
579579
)
580580

581581
# Check the child project is already a superproject
582582
if value.subprojects.exists():
583583
raise serializers.ValidationError(
584-
'Child is already a superproject',
584+
_('Child is already a superproject'),
585585
)
586586
return value
587587

@@ -590,7 +590,7 @@ def validate_alias(self, value):
590590
subproject = self.parent_project.subprojects.filter(alias=value)
591591
if subproject.exists():
592592
raise serializers.ValidationError(
593-
'A subproject with this alias already exists',
593+
_('A subproject with this alias already exists'),
594594
)
595595
return value
596596

@@ -599,13 +599,13 @@ def validate(self, data):
599599
# Check the parent and child are not the same project
600600
if data['child'].slug == self.parent_project.slug:
601601
raise serializers.ValidationError(
602-
'Project can not be subproject of itself',
602+
_('Project can not be subproject of itself'),
603603
)
604604

605605
# Check the parent project is not a subproject already
606606
if self.parent_project.superprojects.exists():
607607
raise serializers.ValidationError(
608-
'Subproject nesting is not supported',
608+
_('Subproject nesting is not supported'),
609609
)
610610
return data
611611

0 commit comments

Comments
 (0)