skip to navigation
skip to content

django-o18n 1.0

/<country>/<language>/ URL scheme, like Django's i18n_patterns.

Use case

Django’s [i18n_patterns][] prefixes URLs with a language code which may contain a variant e.g. /en, /fr, /fr-ca.

o18n_patterns is similar but it prefixes URLs with a country code and a language code e.g. /us, /ca/en, /ca/fr.

This is useful for websites that are mainly segmented by country rather than by language.



Some countries have a main language. In that case, the URL for the main language only contains the country e.g. /us. URLs for other languages contain the country and the language e.g. /us/es.

Some countries don’t have a main language — and it may be a sensitive topic! In that case, all URLs contain the country and the language e.g. /ca/en and /ca/fr.

Unlike i18_patterns, o18n_patterns doesn’t attempt to determine the country and language and automatically redirect the user to the appropriate URL.

If an URL doesn’t match a valid country and language combination, it doesn’t resolve with o18n_patterns and no country is activated. Vice-versa, if no country is active, reversing an URL raises an exception.

File Type Py Version Uploaded on Size
django-o18n-1.0.tar.gz (md5) Source 2014-07-01 9KB
django_o18n-1.0-py2.py3-none-any.whl (md5) Python Wheel 3.4 2014-07-01 9KB
  • Downloads (All Versions):
  • 5 downloads in the last day
  • 36 downloads in the last week
  • 166 downloads in the last month