Michel,

Thanks for you reply. 
My ideia was to make it without the '/es/' or '/en/' starting the url.

Let's say a user share an 'es' link to an american user.
Like this:  '/ayuda/'
I wanted the american user to be able to open it using language defined in 
user's session ('en').

Thanks in advance,
Felipe







On Friday, February 7, 2014 11:23:39 PM UTC-2, werefrog wrote:
>
> 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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/e8ee8313-2e6a-4c5d-9800-e37fe2d5584d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to