Django Rest Internationalization not working on some language

178 Views Asked by At

I am using Django Rest Framework and its Internationalization function. I can now get a auto translated response on default errors response by adding "Accept-Language" on header. I tried "zh-hans" is working but "zh-hant" not working. I also tried "ja-JP" , "de" its working. Is there a list for me to check the language code? I found a name list from here https://explore.transifex.com/django-rest-framework-1/django-rest-framework/ it said its support Chinese Traditional and Chinese (Taiwan). I tried zh-tw not working too.

1

There are 1 best solutions below

3
Jinn Lin On

I have the same issue. I found simple-jwt don't have zh_hant within his ...\Lib\site-packages\rest_framework_simplejwt\locale directory. (the zh_hans is existed here)

Create a zh_Hant directory within ...\locale diretory, copy files with subdirectory of zh_Hans into zh_Hant, convert ...\zh_Hant\LC_MESSAGES\django.po content to be Chinese Traditional, and then compile it to be django.mo file, it is workable for me.