0

I'm Korean and using django-all-auth in my Django Project.

I checked that there is Korean .po file in django-all-auth.

But all expressions are english, not Korean.

I just followed Installation part and Configuration part in doc.

And here is my settings.py

LANGUAGE_CODE = 'ko-kr'

TIME_ZONE = 'Asia/Seoul'

USE_I18N = True

USE_L10N = True

USE_TZ = True

Did I miss something?

user3595632
  • 5,380
  • 10
  • 55
  • 111
  • Have you checked your urlpatterns to be 118n? And where is the url(r'^accounts/', include('allauth.urls')), part included? – Shashishekhar Hasabnis Nov 22 '16 at 10:09
  • @ShashishekharHasabnis Thanks for advices. I refer your advices and edit url codes like this : https://gist.github.com/rightx2/7a15208cb24e4c88b6c23a67b4543964. And when I access singup page, url showed up like this: http://localhost:8000/ko-kr/accounts/login/ but still language is in english. (other pages are in english, too) – user3595632 Nov 22 '16 at 14:40

2 Answers2

0

You need to activate the internationalization middleware:

In your settings.py set:

MIDDLEWARE = {...,"django.middleware.locale.LocaleMiddleware",...}

As said in the Doc

Make sure you’ve activated translation for your project (the fastest way is to check if MIDDLEWARE includes django.middleware.locale.LocaleMiddleware). If you haven’t yet, see How Django discovers language preference.

-1

Since now your pages are configured to route to the desired internationalization you now need to provide localization yourself. They will not automatically be translated. You need to handle it yourself. To do so you will have to mark the elements that need to be translated by using

from django.utils.translation import ugettext as _

Now mark the text that you need to translate by using ugettext as _in the following way:-

class PollPluginPublisher(CMSPluginBase):
    model = PollPluginModel  # model where plugin data are saved
    module = _("Polls")
    name = _("Poll Plugin")  # name of the plugin in the interface

Now the elements are marked to be translated in our case ("Polls") and ("Poll Plugin"). After dealing with this you can run following command in your root directory:-

django-admin makemessages -l de

Replace the last "de" with your language locale name. What this command does is that it will create the po file which will just store the elements that need to be translated. Be sure that your LOCALE_PATH is set properly.

After this done you can use the following django-packages for translations:-

1) django-rosetta :- https://django-rosetta.readthedocs.io/en/latest/

2) django-modeltranslation:- http://django-modeltranslation.readthedocs.io/en/latest/

For further reference of LOCALIZATION you can view:-

https://docs.djangoproject.com/en/1.10/topics/i18n/translation/#localization-how-to-create-language-files
Shashishekhar Hasabnis
  • 1,636
  • 1
  • 15
  • 36