以前,我使用DRF (django-rest-framework),还使用了locale
(django翻译)。但是问题是,我无法将"You do not have permission to perform this action."
的消息修改为另一种语言,例如:id
。
顺便说一句,
rest_auth
和我自己的应用程序的翻译语言运行良好。
这是我的兰光settings.py
LANGUAGES = (
('id', 'Indonesia'),
('en', 'English')
)
DEFAULT_LANGUAGE = 1
LOCALE_PATHS = (
os.path.join(BASE_DIR, 'locale'),
os.path.join(BASE_DIR, 'locale/rest_auth'),
)
LANGUAGE_CODE = 'id'
USE_I18N = True
USE_L10N = True
decorators.py
和permissions.py
中的错误消息也已实现。但是错误消息仍然没有改变。