Multi-language support settings under the Django framework

Source: Internet
Author: User

The multi-language support settings under the Django Framework are as follows:

1. Installation of GNU GetText Tools

Django is built to support multiple languages through GetText, so you need to install

is: http://gnuwin32.sourceforge.net/packages/gettext.htm

Window platform Download binaries version (compiled exe, install directly), then set the system path

Ubuntu platform: sudo apt-get install GetText

2, set the project to settings.py

= Locale_paths = [Os.path.join (base_dir)]time_zone = use_i18n = use_l10n = Use_tz =



3, set the project under model.py

From django.utils.translation import Ugettext_lazy as _

String to parse with _ (' string to be translated ')


3, execute the command django-admin makemessages will generate Django.po file in the locale directory



This article is from the "Rockets in Progress" blog, please be sure to keep this source http://290916.blog.51cto.com/280916/1763773

Multi-language support settings under the Django framework

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.