django-i18nurls

Translate URL patterns and prefix URLs with language-code
Download

django-i18nurls Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Publisher Name:
  • Orne Brocaar
  • Publisher web site:
  • http://brocaar.com

django-i18nurls Tags


django-i18nurls Description

Translate URL patterns and prefix URLs with language-code django-i18nurls is a Django pluggable app that makes it possible to translate URL patterns by using gettext. As well it contains a custom patterns function for prefixing URLs with the active language-code (eg: /en/news/, /nl/nieuws/) and a middleware to activate the language code in the prefix (for incoming request).Examples:# urls.pyfrom django.conf.urls.defaults import patterns, include, urlfrom django.utils.translation import ugettext_lazy as _from i18nurls.defaults import locale_prefixed_patternspatterns = locale_prefixed_patterns('', url(_(r'^users/register/$', 'your.view', name='account-register')),)# In your shell, after updating your translations (with makemessages / compilemessages)>>> activate('nl')>>> reverse('account-register')'/nl/gebruikers/registeren/'>>> activate('en')>>> reverse('account-register')'/en/users/register/'Installation- Add i18nurls to your settings.INSTALLED_APPS- Add i18nurls.middleware.LocaleMiddleware to your settings.MIDDLEWARE_CLASSES. Note: This middleware replaces the default Django LocaleMiddleware. Requirements: · Python · Django


django-i18nurls Related Software