#25751: Translation of strings in a javascript file: Docs are incorrect
-------------------------------------+-------------------------------------
     Reporter:  raratiru             |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  new
    Component:                       |                  Version:  1.8
  Internationalization               |
     Severity:  Normal               |               Resolution:
     Keywords:  javascript           |             Triage Stage:
  translation                        |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by raratiru:

Old description:

> To translate a string in a javascript file, the
> [https://docs.djangoproject.com/en/1.8/topics/i18n/translation/#module-
> django.views.i18n docs] propose the following setup in the urls.py:
>

> {{{
> from django.views.i18n import javascript_catalog
>
> js_info_dict = {
>     'packages': ('your.app.package',),
> }
>
> urlpatterns = [
>     url(r'^jsi18n/$', javascript_catalog, js_info_dict),
> ]
> }}}
>
> This will not work unless the javascript url is added to urlpatterns
> under i18n_patterns:
>

> {{{
> from django.views.i18n import javascript_catalog
> from django.conf.urls.i18n import i18n_patterns
>
> js_info_dict = {
>     'packages': ('your.app.package',),
> }
>
> urlpatterns = [
>     ...
> ]
>
> urlpatterns += i18n_patterns(
>     url(r'^jsi18n/$', javascript_catalog, js_info_dict),
> )
> }}}

New description:

 To translate a string in a javascript file, the
 [https://docs.djangoproject.com/en/1.8/topics/i18n/translation/#module-
 django.views.i18n docs] propose the following setup in the urls.py:


 {{{
 from django.views.i18n import javascript_catalog

 js_info_dict = {
     'packages': ('your.app.package',),
 }

 urlpatterns = [
     url(r'^jsi18n/$', javascript_catalog, js_info_dict),
 ]
 }}}

 This will not work unless the javascript url is added to urlpatterns under
 i18n_patterns:


 {{{
 from django.views.i18n import javascript_catalog
 from django.conf.urls.i18n import i18n_patterns

 js_info_dict = {
     'packages': ('application.name',),
 }

 urlpatterns = [
     ...
 ]

 urlpatterns += i18n_patterns(
     url(r'^jsi18n/$', javascript_catalog, js_info_dict),
 )
 }}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/25751#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.a6b0d067d705cdf70358860257935ba3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to