I am trying to translate Dates in API's(Django rest framework), well as of now Internationalization and localization is working for all the other things but i am stuck at Dates.
There is only English and French language and also i have restarted server few times but not able to get dates in FR as you can see i have used Rosetta
Example code :
@staticmethod
def get_start_date(obj):
return obj.start_date.strftime("%d %B, %Y")
when lang code is en O/P is :
start_date": "01 January, 2016"
but when lang code is fr expected result:
start_date": "01 Janvier, 2016"
still it is showing in english
settings.py i have successfully added basic settings still for your information
MIDDLEWARE_CLASSES
'django.middleware.locale.LocaleMiddleware',
USE_L10N = True
Thanks in advance
It's hack too, but helping. Add this in Rest view:
import locale
locale.setlocale(locale.LC_TIME, "ru_RU.utf-8")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With