Django Translation Using .PO FileDec 16, 2013 · 1 min read · 7 comments
When comes to using multiple languages in one single site, Django is very handy. You can use .po file to do your translation for you.
Table of contents
How to do that ︎
Process is very simple: First create .po file. To make .po file I would suggest to use poedit or Rosetta. Here is another option that is using django’s very own Localisation. Second create a folder name locale within tour django project and add the language named (for example: ru__RU for Russian language) within locale. Within ru___RU folder, create another folder named ‘LC__MESSAGES’. There save the .po file you have created. Save the .po file in name django.po. File Map:
Project | locale | ru_RU | LC_MESSAGES | django.po
Now run this command:
django-admin.py compilemessages to generate .mo file(django.mo). Third comes to final touch. in Language settings in your settings.py add ru_RU like this:
LANGUAGES = ( ('en-us', 'English'), ('ru_RU', 'Russian'), ) LANGUAGE_CODE = 'en-us' 'ru_RU'
Add locale path :
LOCALE_PATHS = ( os.path.join(PROJECT_PATH, '../locale'), )
and finally add a middleware in in MIDDLEWARE_CLASSES or MIDDLEWARES.
That should the trick.
Hugo is a fantastic framework to generate static site from markdown and serve them. Using environment variables in …
I wanted to add a rich text editor within django administrator. It is not that hard to add a rich text editor, as there …