Opened 14 months ago

Last modified 5 months ago

#22404 assigned New feature

Make front-end getext catalog available as JSON

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

Description

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 (3)

comment:1 Changed 14 months ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Yes, that should be possible somehow.

comment:2 Changed 10 months ago by manologab

  • Owner changed from nobody to manologab
  • Status changed from new to assigned

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.

Last edited 10 months ago by manologab (previous) (diff)

comment:3 Changed 5 months ago by timgraham

  • Component changed from Translations to Internationalization
  • Version changed from 1.6 to master
Note: See TracTickets for help on using tickets.
Back to Top