Checklist
Steps to reproduce
- Use LocaleMiddleWare
MIDDLEWARE = [
# 'debug_toolbar.middleware.DebugToolbarMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
- Set Languages
LANGUAGES = [
('en', _('English')),
('pt', _('Portuguese')),
]
# LANGUAGE_CODE = 'pt'
LOCALE_PATHS = (os.path.join(BASE_DIR, 'locale'),)
TIME_ZONE = 'America/Sao_Paulo'
- Configure URL Paths for i18n pattern
urlpatterns = i18n_patterns(
...
path('admin/', admin.site.urls), # Django Admin
path('sales/', include('Sales.urls')), # DRF Router to DRF ModelViewSet actions
...
)
- Create a simple view using Django template and translate that or use the admin and then test the ModelViewSet actions with internatiolization
Expected behavior
DRF Viewsets should translate according to the URL pattern. Ex:
- GET example.org/pt/sales/
- GET example.org/en/sales/000001/
- OPTIONS example.org/pt/sales/000001/
...
Actual behavior
Django is translating as usual but DRF Views does not.
LANGUAGE_CODE = 'pt'
# OR
LANGUAGE_CODE = 'en'
Looks like the steps in How Language is Determined Is not working properly.
If there is any other setting i can test, or anything i can do to help, please let me know.
Checklist
masterbranch of Django REST framework.Steps to reproduce
Expected behavior
DRF Viewsets should translate according to the URL pattern. Ex:
...
Actual behavior
Django is translating as usual but DRF Views does not.
Looks like the steps in How Language is Determined Is not working properly.
If there is any other setting i can test, or anything i can do to help, please let me know.