Well, official documentation says clearly it should fall-back (ex: fr-fr to 
fr then to en) but my case raises 404 error.

Source: https://django.readthedocs.io/en/1.5.x/topics/i18n/translation.html

If a base language is available but the sublanguage specified is not, 
> Django uses the base language. For example, if a user specifies de-at 
> (Austrian German) but Django only has de available, Django uses de.
>
> ...
>
> LANGUAGES = ( ('de', _('German')), ('en', _('English')), )
>
> This example restricts languages that are available for automatic 
> selection to German and English (and any sublanguage, like de-ch or en-us).
>
Here are related code portions:


*settings.py*


# Language code for this installation. All choices can be found here:# 
http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en'

LANGUAGES = (
  ( 'ar', "Arabic" ),
  ( 'en', "English" ),
  ( 'fr', "French" ),
  ( 'id', "Indonesian" ),
  ( 'ja', "Japanese"),
  ( 'ku', "Kurdish" ),
  #( 'ur', "Urdu" ),
  ( 'ms', "Malay" ),
  ( 'ml', "Malayalam" ),
  #( 'tr', "Turkish" ),
  ( 'es', "Spanish" ),
  ( 'pt', "Portuguese"),
  #( 'sv', "swedish" ))
# These are languages not supported by Django core. We have to provide# their 
info here so we can use them in our templates. This is mainly# used in 
`wui.templatetags.languages`.
EXTRA_LANGUAGES = {
  'ku': {
    'code': 'ku',
    'name': 'Kurdish',
    'bidi': True,
    'name_local': 'Kurdish'
  },
  'ms': {
    'code': 'ms',
    'name': 'Malay',
    'bidi': False,
    'name_local': 'Malay'
  },}


SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not# to 
load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and# 
calendars according to the current locale
USE_L10N = True

*urls.py*


from django.conf.urls import patterns, include, urlfrom django.conf.urls.i18n 
import i18n_patterns
# Uncomment the next two lines to enable the admin:# from django.contrib import 
admin# admin.autodiscover()

urlpatterns = patterns( '',
  url( r'^jos2', 'wui.views.jos2' ),
  url(r'^r', 'wui.views.one_aya_page'),
  url(r'^$', 'wui.views.results'),
  # url( r'^admin/', include( admin.site.urls ) ),)
# These URLs accept the language prefix.
urlpatterns += i18n_patterns('',
  url(r'^$', 'wui.views.results'),
  url(r'^(?P<unit>\w{3,15})/', 'wui.views.results'),)
# 404 not found handler

handler404 = 'wui.views.custom_404'

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3151fd14-9910-48f1-803e-be038afd9769%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to