Skip to main content

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

Project description

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.

[i18n_patterns]: https://docs.djangoproject.com/en/stable/topics/i18n/translation/#django.conf.urls.i18n.i18n_patterns

Features

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.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-o18n-1.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

django_o18n-1.0-py2.py3-none-any.whl (10.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-o18n-1.0.tar.gz.

File metadata

  • Download URL: django-o18n-1.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-o18n-1.0.tar.gz
Algorithm Hash digest
SHA256 a44dd03b92fd0197abef97b65bec34c640e4998087e3a782b5c25fdcbf15c873
MD5 7fd65267e315755938d77ff3efcaa61d
BLAKE2b-256 7fb4bdec4c2fb24f2db0126e6b7d5a97bd7c122cfc0480c1a8a9d7bf22b3b2f2

See more details on using hashes here.

File details

Details for the file django_o18n-1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_o18n-1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0a6952f23ccbbbb44406bdd38f40eb88b2349cbcd8a9e576e6c581f551be5194
MD5 b60cb4ada5a0ca61a22dc9905de14e61
BLAKE2b-256 f72a6054a838973636aa76d4b3a21cf1af50b941f86881c515e45beab0d093c2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page