Hello,

I don't know where you're trying the troublesome reverse but maybe the following can help.


# myproject.urls

from django.conf.urls import patterns, url
from django.utils.translation import ugettext_lazy as _
from django.conf.urls.i18n import i18n_patterns

from help.views import HelpView


urlpatterns = patterns('',
    #
)

urlpatterns += i18n_patterns('',
    url(_(r'^help/$'), HelpView.as_view(), name='help-view')),
    url(_(r'^news/'), include('news.urls')), # can add namespace
)


# news.urls

from django.conf.urls import patterns, url
from django.utils.translation import ugettext_lazy as _
from .views import PageOneView, PageTwoView


urlpatterns = patterns('',
    url(_(r'^$'), PageOneView.as_view(), name='news'),
    url(_(r'^page-one/$'), PageOneView.as_view(), name='news-page-one'),
    url(_(r'^page-two/$'), PageTwoView.as_view(), name='news-page-two'),
)

# test.py

from django.utils.translation import activate

activate('es')
#...


# resulting urls

/en/help/
/es/ayuda/

/en/news/
/en/news/page-one/
/en/news/page-two/
/es/noticias/
/es/noticias/pagina-um/
/es/noticias/pagina-dos/

Of course, you need to translate to spanish.

# https://docs.djangoproject.com/en/dev/topics/i18n/translation/#message-files
python manage.py makemessages -l es
# python manage.py makemessages -a

# translate resulting file then …

# https://docs.djangoproject.com/en/dev/topics/i18n/translation/#compiling-message-files
python manage.py compilemessages

Regards,
Michel

--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52F5871B.8070404%40yahoo.fr.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to