-
Book Overview & Buying
-
Table Of Contents
Django 1.0 Template Development
If you need to offer your site in multiple languages, you can do so by using the internationalization (i18n) libraries built into the Django framework. Instead of creating another version of your site in a different language, you can translate strings in your templates depending on the user's language preferences or your site's configuration settings.
To enable i18n, you must configure your project by ensuring that USE_I18N is set to True and defining a LANGUAGE_CODE for your site. In your templates, load the i18n tag library and mark strings as translatable by putting them inside a {% trans %} tag. Run the django-admin.py script to make message files, then create your translations in those files, and run the script again to compile the message files.
To automatically choose the user's language preference based on his or her browser settings, load the LocaleMiddleware after any cache or session middleware in your site's settings file.
This chapter only scratches the surface of what...
Change the font size
Change margin width
Change background colour