Opened 3 years ago

Closed 15 months ago

#22404 closed New feature (fixed)

Make front-end getext catalog available as JSON

Reported by: ian.morrison.a@… Owned by: Sergey Kolosov
Component: Internationalization Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


This is a question related to #22403.

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?

Change History (10)

comment:1 Changed 3 years ago by Aymeric Augustin

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

Yes, that should be possible somehow.

comment:2 Changed 2 years ago by manologab

Owner: changed from nobody to manologab
Status: newassigned

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:

    '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",

Here is the code:

Please let me know if you agree with this approach before going any further.

Last edited 2 years ago by manologab (previous) (diff)

comment:3 Changed 23 months ago by Tim Graham

Component: TranslationsInternationalization
Version: 1.6master

comment:4 Changed 17 months ago by Sergey Kolosov

Owner: changed from manologab to Sergey Kolosov

Working on that during DjangoCon Europe 2015 sprints.

comment:6 Changed 17 months ago by Sergey Kolosov

Has patch: set

comment:7 Changed 17 months ago by Moritz Sichert

Triage Stage: AcceptedReady for checkin

Looks good!

comment:8 Changed 17 months ago by Tim Graham

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

Reviewed the PR a bit more.

comment:9 Changed 15 months ago by Sergey Kolosov

Patch needs improvement: unset

comment:10 Changed 15 months ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 24440422:

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.

Note: See TracTickets for help on using tickets.
Back to Top