-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translation missing for part of throttle warning #6177
Comments
It looks like the django-rest-framework/rest_framework/exceptions.py Lines 223 to 228 in 5f1f2b1
|
Any quick workaround possible? |
Re-raise as a custom Exception class that has translations? |
Bump. Just faced this, is it possible to get this fixed in the next minor release? Rather than a missing translation, this is also looks like a misuse of the translation framework. Monkey patch the exception in the meantime.
|
Adding this to the milestone, as I don't think there is any significant complexity in fixing this.
Can you clarify? |
I'm not 100% sure about what's the issue, but ngettext doesn't seem to be working unless the text itself is also a translated string. Please see my monkey patch above. Looks like this line:
Will only work if extra_detail_singular and extra_detail_plural are lazy translation strings (or translated in place). Edit: Probably related to the fact that a variable is used there, and that .format is also used. Please read the django docs for a good example about how to use ungettext: https://docs.djangoproject.com/en/2.2/topics/i18n/translation/#pluralization |
This would make sense.
DRF uses |
I'm using the throttling mechanism of DRF. When the exception is shown that actually the request was throttled, one part of the message is translated, the other part is not:
I couldn't find the part "expected available in X seconds" in the translation file so I guess it is just missing?
I'm using
djangorestframework==3.8.2
.Best regards
Ron
The text was updated successfully, but these errors were encountered: