i18n json catalog

83 views
Skip to first unread message

Manolo Gabriel Ramirez Torrico

unread,
Aug 1, 2014, 2:43:58 PM8/1/14
to django-d...@googlegroups.com
Hi all,

I would like to contribute with this feature, you can see the proposal in #22404.
If you agree with the idea I could start writing the documentation.

Regards,

Manolo Ramirez T.

Manolo Gabriel Ramirez Torrico

unread,
Aug 5, 2014, 4:00:22 PM8/5/14
to django-d...@googlegroups.com
Hi all,

Sorry if I didn't explain myself clearly, I will try to do it better. It will be nice to contribute something to Django.

What I a propose is to provide a view to retrieve the i18n translations catalog as JSON, this is something that was requested in the ticket: https://code.djangoproject.com/ticket/22404 It could be useful for third party applications and client libraries.

The JSON response of the view will have the form:

{
//translations catalog
catalog
:{
   
//a simple translation entry
   
'translate this':'traduce esto',

   
//translation with plural form
   
'one plural sample': [  
       
'un ejemplo de plural',
       
'muchos ejemplos de plural'
   
]
},

//expression for the plural index
//when null -> 'n>1?1:0'
plural
: null,

//formats used by the locale
formats
: {
    "DATETIME_FORMAT": "N j, Y, P",
   
"DATE_FORMAT": "N j, Y",
   
"DECIMAL_SEPARATOR": ".",
   
...
}
}


These are basically the 3 elements used by the javascript functions of the i18n view javascript_catalog to perform the translations.

Please, let me know what do you think.

Regards,

Manolo Ramirez T.
Reply all
Reply to author
Forward
0 new messages