Skip to content

Error messages are not fully translated #4300

Closed
@sassanh

Description

@sassanh

Checklist

  • [x I have verified that that issue exists against the master branch of Django REST framework.
  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • This is not a usage question. (Those should be directed to the discussion group instead.)
  • This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.)
  • I have reduced the issue to the simplest possible case.
  • I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.)

Steps to reproduce

Make a model in django that has a unique field, make a viewset with default model serializer for it, create an instance of the model with api. Try to create another instance with the same value for unique field as first instance while your language is set to something other than en, it doesn't translate the model name. The error message is %(model_name)s with this %(field_labels)s already exists. and the model_name doesn't get translated.

Expected behavior

It to translate the whole error message.

Actual behavior

It doesn't.

I tried to fix it in this pull request: #4299 but after seeing how many tests have failed I concluded that you're using method get_field_kwargs in field_mapping.py for other purposes than making error messages. So I don't know how to fix it that doesn't break other parts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions