Hello,
I’m working on translations part, translations are going to be in Hindi (hi)
Providing some code snippet
from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
class BaseSerializer(serializers.Serializer):
pass
class BaseChoiceField(serializers.ChoiceField):
default_error_messages = {
'invalid_choice': _('Invalid choice.')
}
class AccountRegisterSrz(BaseSerializer):
user_type = BaseChoiceField(choices=MyChoice().user_type)
phone_code = serializers.CharField(max_length=7)
phone = serializers.CharField()
Some of the default messages are translated but DRF messages are not translated in Hindi, after digging in DRF module I’ve found that for Hindi translations are not available. How can translate these default messages as I’ve tried to by creating a BaseChoiceField and using it but it still gives me the Invalid choice
only not it’s translations, Also then how can I do the translations for the dynamic strings as well like this one Ensure this field has no more than {max_length} characters.