My proposal is create a CBV. I don't understand the use of templates for
rendering a view (related ticket).
Now, the initial code is available on this file: https://github.com/niwibe
/django-jsgettext/blob/master/djsgettext/views.py
If the proposal is accepted, I will create a patch.
--
Ticket URL: <https://code.djangoproject.com/ticket/19567>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_better_patch: => 0
* resolution: => needsinfo
* needs_tests: => 0
* needs_docs: => 0
Comment:
I'm not sure I see what you're proposing here, or why you're proposing it.
#18231 describes a problem with the javascript catalog; that is an
accepted bug that needs to be solved.
I'm not sure I see what moving to a CBV approach gains us. You say the
current implementation is 'monolithic' - what problem are you trying to
solve that the current implementation prevents?
Before you get to committed to implementing a solution, we need to be
clear on what problem you're solving. "It's not a CBV" isn't a problem
unless a class-based approach will give flexibility that is actually
required, and based on your sample implementation, I'm not sure I see what
flexibility we will gain by making the view class-based.
Feel free to reopen with more details on the advantages of going down a
class-based approach to the i18n catalog.
--
Ticket URL: <https://code.djangoproject.com/ticket/19567#comment:1>
* status: closed => new
* resolution: needsinfo =>
Comment:
I think the advantages are obvious but I'll try to explain:
- Allow users to change certain behaviors without completely rewriting the
view
- Allow expose more than one gettext domain (and not force to use only a
"djangojs" domain)
It is very useful to expose different domain that "djangojs". A real case:
javascript templates.
The current makemessages command not parse well html files with javascript
templates (with domain "djangojs"). A clean solution is to create another
command which parses only js templates and place it contents in another po
file distinct of "djangojs.po".
The current view is monolithic and if you want to change any behavior, the
solution is full rewrite. I think what the framework must give some
facility for doing this.
https://github.com/niwibe/django-jsgettext this plugin allows collect
messages from htmls what contains javascript templates in other domain
distinct from djangojs and currentlly no way to expose these messages to
the js.
--
Ticket URL: <https://code.djangoproject.com/ticket/19567#comment:2>
* type: Uncategorized => New feature
* component: Uncategorized => Internationalization
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/19567#comment:3>
* has_patch: 0 => 1
Comment:
https://github.com/django/django/pull/678
--
Ticket URL: <https://code.djangoproject.com/ticket/19567#comment:4>
* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
* needs_docs: 0 => 1
Comment:
I’ve made a comment in the pull request.
--
Ticket URL: <https://code.djangoproject.com/ticket/19567#comment:5>
* status: new => assigned
* owner: nobody => alejandro
--
Ticket URL: <https://code.djangoproject.com/ticket/19567#comment:6>
* owner: alejandro => claudep
* needs_tests: 1 => 0
Comment:
I have a [https://github.com/django/django/pull/6257 revised patch] with
work in progress.
--
Ticket URL: <https://code.djangoproject.com/ticket/19567#comment:7>
* needs_better_patch: 1 => 0
* needs_docs: 1 => 0
Comment:
[https://github.com/django/django/pull/6257 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/19567#comment:8>
* needs_better_patch: 0 => 1
Comment:
Left some review comments.
--
Ticket URL: <https://code.djangoproject.com/ticket/19567#comment:9>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/19567#comment:10>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/19567#comment:11>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"de40cfbe74642df1e94c131e1adaa3363173c0cf" de40cfbe]:
{{{
#!CommitTicketReference repository=""
revision="de40cfbe74642df1e94c131e1adaa3363173c0cf"
Fixed #19567 -- Added JavaScriptCatalog and JSONCatalog class-based views
Thanks Cristiano Coelho and Tim Graham for the reviews.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/19567#comment:12>
Comment (by Tim Graham <timograham@…>):
In [changeset:"2b20e4148f4f54431834e6a43af6c39dc75e6362" 2b20e41]:
{{{
#!CommitTicketReference repository=""
revision="2b20e4148f4f54431834e6a43af6c39dc75e6362"
Refs #19567 -- Removed deprecated javascript_catalog() and json_catalog()
views.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/19567#comment:13>