﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
22106	catalogs of django.views.i18n.javascript_catalog overwrite each other	Moritz Sichert	Moritz Sichert	"Right now you can only use one instance of `javascript_catalog`, because they will override each other if you add more to one site.
This problem can easily be solved by making `packages` in `kwargs` for `javascript_catalog` include all packages needed instead of having a multiple views for different packages. That however makes the internationalization of javascript code that does not directly lie in the main application somewhat inflexible.

== Example ==

`appA`: app that contains the widget `FunkyJSWidget` that relies on some javascript and needs jsi18n.
`appMain`: your main app that contains all the views for your website. Your website also contains some javascript code that also uses jsi18n. It uses `appA.FunkyJSWidget` on some forms as well.

`INSTALLED_APPS` now is `('appA', 'appMain')`.
The problem now occurs on all your pages that use `appA.FunkyJSWidget`. Because the widget includes its javascript_catalog (per Media-class for example) as well as your `appMain`, one will override the other. You could obviously add `appA` to `appMain.views.jsi18n`'s `packages` argument but this shouldn't be necessary.

== Possible Solution ==

Modify `django.views.i18n.js_catalog_template` to detect if a catalog already exists. If it does, update it instead of overriding it. A minor issue is that the template omits some functions if they are not needed. That should be checked for all included javascript_catalogs, too."	Bug	closed	Internationalization	dev	Normal	fixed	jsi18n javascript catalog		Ready for checkin	1	0	0	0	0	0
