django-i18nurls

Software Screenshot:
django-i18nurls
Software Details:
Version: 0.7
Upload Date: 14 Apr 15
Developer: Orne Brocaar
Distribution Type: Freeware
Downloads: 11

Rating: 5.0/5 (Total Votes: 1)

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.py
from django.conf.urls.defaults import patterns, include, url
from django.utils.translation import ugettext_lazy as _

from i18nurls.defaults import locale_prefixed_patterns


patterns = 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.

What is new in this release:

  • {% language %} template-tag implemented (thanks to Harro van der Klauw).
  • LocaleMiddleware class is not patched anymore (Issue #3).
  • i18n_patterns is not patched anymore.
  • Trailing slash is now optional in LocaleMiddleware regex.

What is new in version 0.6.1:

  • Templates and locale folder added to setup.py script (Issue #1).

What is new in version 0.6:

  • API changed so it will match with i18n_patterns in upcoming Django 1.4 release.

Requirements:

  • Python
  • Django

Other Software of Developer Orne Brocaar

WTFMongoengine
WTFMongoengine

15 Apr 15

Comments to django-i18nurls

Comments not found
Add Comment
Turn on images!