Opened 14 years ago
Closed 13 years ago
#18231 closed Bug (fixed)
i18n javascript_catalog View Pollutes Global Namespace
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Internationalization | Version: | dev |
| Severity: | Normal | Keywords: | javascript i18n |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | yes |
| Easy pickings: | no | UI/UX: | no |
Description
In addition to the translation functions (gettext, ngettext, etc.), the global variables catalog and formats are created. These variables are required to exist and be in the correct format in order for the translation functions to work.
Seeing as how these are common words, with a relatively high likelihood of being clobbered, I propose we use the module pattern (an immediately invoked function).
This patch also uses vanilla objects for catalog and formats as those are the preferred type for dictionaries in JavaScript.
Attachments (1)
Change History (10)
by , 14 years ago
| Attachment: | js-i18n-patch.diff added |
|---|
comment:1 by , 14 years ago
comment:2 by , 14 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|---|
| Type: | Uncategorized → Bug |
Accepting in general, but not generally excited about the indentation changes.
comment:3 by , 13 years ago
What do you think about the following idea: make all the generated javascript to be a string with django template syntax? That would allow us not to worry about indentation changes.
comment:6 by , 13 years ago
I've got an updated branch, but I can't update the pull request since the issue is closed. Let me know if want to reopen the PR and have me update it or if I should create a new PR instead.
comment:7 by , 13 years ago
Current PR is almost there but is causing one failure and seven errors in the Django test suite, all of the related to the js i18n catalog.
comment:9 by , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
The patch corresponds to pull request #13 on the github repository.
https://github.com/django/django/pull/13