i18n
This commit is contained in:
parent
d3f83150f1
commit
6f8de01840
2 changed files with 17 additions and 3 deletions
|
|
@ -119,15 +119,15 @@ REST_FRAMEWORK = {
|
|||
# 'rest_framework.throttling.AnonRateThrottle',
|
||||
# ],
|
||||
'DEFAULT_THROTTLE_RATES': {
|
||||
'otp_min': '1/min',
|
||||
'otp_min': '2/min',
|
||||
'otp_day': '50/day',
|
||||
},
|
||||
'EXCEPTION_HANDLER': 'utils.exceptions.exception_handler',
|
||||
}
|
||||
|
||||
SPECTACULAR_SETTINGS = {
|
||||
'TITLE': 'Gooyal Accounts',
|
||||
'DESCRIPTION': 'Gooyal Accounts API reference',
|
||||
'TITLE': 'Accounts',
|
||||
'DESCRIPTION': 'Accounts API reference',
|
||||
'VERSION': '1.0.0',
|
||||
'SERVE_INCLUDE_SCHEMA': False,
|
||||
# OTHER SETTINGS
|
||||
|
|
|
|||
14
utils/i18n.py
Normal file
14
utils/i18n.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
from django.utils import translation
|
||||
|
||||
class ForceAdminLanguageMiddleware:
|
||||
def __init__(self, get_response):
|
||||
self.get_response = get_response
|
||||
|
||||
def __call__(self, request):
|
||||
if request.path.startswith('/admin/'):
|
||||
translation.activate('en')
|
||||
request.LANGUAGE_CODE = 'en'
|
||||
else:
|
||||
translation.activate('fa')
|
||||
request.LANGUAGE_CODE = 'fa'
|
||||
return self.get_response(request)
|
||||
Loading…
Add table
Reference in a new issue