It seems like it would be nice if the front-end gettext catalogs were
simply available as JSON (and not as a custom js function, injected into
the global namespace). This would allow the community to use (or build)
separate client libraries for handing these translation strings.
Does that seem like a feature that others would be interested in?
--
Ticket URL: <https://code.djangoproject.com/ticket/22404>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* needs_tests: => 0
* needs_docs: => 0
Comment:
Yes, that should be possible somehow.
--
Ticket URL: <https://code.djangoproject.com/ticket/22404#comment:1>
* owner: nobody => manologab
* status: new => assigned
Comment:
Hi, I've been working with Django for the last few months and I will like
to contribute with this feature.
What I propose is a javascript view json_catalog that returns the language
settings as a json object like this:
{{{
{catalog:{
'translate this':'traduce esto',
'one plural sample': [
'un ejemplo de plural',
'muchos ejemplos de plural'
]
},
plural: null,
formats: {
"DATETIME_FORMAT": "N j, Y, P",
"DATE_FORMAT": "N j, Y",
"DECIMAL_SEPARATOR": ".",
...
}
}}}
Here is the code:
[https://github.com/manologab/django/tree/ticket_22404]
Please let me know if you agree with this approach before going any
further.
--
Ticket URL: <https://code.djangoproject.com/ticket/22404#comment:2>
* version: 1.6 => master
* component: Translations => Internationalization
--
Ticket URL: <https://code.djangoproject.com/ticket/22404#comment:3>
* owner: manologab => sergeykolosov
Comment:
Working on that during DjangoCon Europe 2015 sprints.
--
Ticket URL: <https://code.djangoproject.com/ticket/22404#comment:4>
Comment (by sergeykolosov):
PR: https://github.com/django/django/pull/4808
--
Ticket URL: <https://code.djangoproject.com/ticket/22404#comment:5>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/22404#comment:6>
* stage: Accepted => Ready for checkin
Comment:
Looks good!
--
Ticket URL: <https://code.djangoproject.com/ticket/22404#comment:7>
* needs_better_patch: 0 => 1
* stage: Ready for checkin => Accepted
Comment:
Reviewed the PR a bit more.
--
Ticket URL: <https://code.djangoproject.com/ticket/22404#comment:8>
* needs_better_patch: 1 => 0
Comment:
PR updated https://github.com/django/django/pull/4808
--
Ticket URL: <https://code.djangoproject.com/ticket/22404#comment:9>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"244404227e8a1c5e241658ef0df789a28ed3bbc6" 24440422]:
{{{
#!CommitTicketReference repository=""
revision="244404227e8a1c5e241658ef0df789a28ed3bbc6"
Fixed #22404 -- Added a view that exposes i18n catalog as a JSON
Added django.views.i18n.json_catalog() view, which returns a JSON
response containing translations, formats, and a plural expression
for the specified language.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22404#comment:10>