On Saturday, May 13, 2017 at 1:35:37 PM UTC+2, Marten Kenbeek wrote:
>
> The regex in `url()` can be translated 
> <https://docs.djangoproject.com/en/1.11/topics/i18n/translation/#translating-urlpatterns>
>  
> using `ugettext_lazy()`, in which case the lazy translation happens when 
> `resolve()` or `reverse()` is called. It seems the current `path()` 
> implementation would force evaluation when the URLs are first loaded, so 
> `resolve()` and `reverse()` would use a fixed language (whichever was 
> active when they were loaded) rather than allowing lazy translations.
>
> I'm not sure how often this feature is used, but it seems like something 
> `path()` should support out of the box. 
>

I agree. It's an oversight which I think is solvable. The 
`LocaleRegexProvider` class already handles the caching.

I will check later, but I think all that's needed is to decorate the `path` 
function with `keep_lazy_str`. Does that seem correct to you?

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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 https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/6c9101a4-2467-4910-aaf8-3fbe0040a04c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to