Code

Ticket #13514: 13514-regression-test.3.diff

File 13514-regression-test.3.diff, 19.5 KB (added by ramiro, 4 years ago)

Added a test to verify things work when both request and default locales are different from English

Line 
1diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
2--- a/tests/regressiontests/admin_views/tests.py
3+++ b/tests/regressiontests/admin_views/tests.py
4@@ -2,7 +2,6 @@
5 
6 import re
7 import datetime
8-from django.conf import settings
9 from django.core.files import temp as tempfile
10 from django.test import TestCase
11 from django.contrib.auth import admin # Register auth models with the admin.
12@@ -16,12 +15,11 @@
13 from django.utils import formats
14 from django.utils.cache import get_max_age
15 from django.utils.html import escape
16-from django.utils.translation import get_date_formats, activate, deactivate
17 from django.utils.encoding import iri_to_uri
18 
19 # local test models
20 from models import Article, BarAccount, CustomArticle, EmptyModel, \
21-    ExternalSubscriber, FooAccount, Gallery, ModelWithStringPrimaryKey, \
22+    FooAccount, Gallery, ModelWithStringPrimaryKey, \
23     Person, Persona, Picture, Podcast, Section, Subscriber, Vodcast, \
24     Language, Collector, Widget, Grommet, DooHickey, FancyDoodad, Whatsit, \
25     Category, Post, Plot, FunkyTag
26@@ -272,33 +270,6 @@
27         response = self.client.get("/test_admin/admin/admin_views/post/")
28         self.failUnless('icon-unknown.gif' in response.content)
29 
30-    def testI18NLanguageNonEnglishDefault(self):
31-        """
32-        Check if the Javascript i18n view returns an empty language catalog
33-        if the default language is non-English but the selected language
34-        is English. See #13388 and #3594 for more details.
35-        """
36-        old_language_code = settings.LANGUAGE_CODE
37-        settings.LANGUAGE_CODE = 'fr'
38-        activate('en-us')
39-        response = self.client.get('/test_admin/admin/jsi18n/')
40-        self.assertNotContains(response, 'Choisir une heure')
41-        deactivate()
42-        settings.LANGUAGE_CODE = old_language_code
43-
44-    def testI18NLanguageNonEnglishFallback(self):
45-        """
46-        Makes sure that the fallback language is still working properly
47-        in cases where the selected language cannot be found.
48-        """
49-        old_language_code = settings.LANGUAGE_CODE
50-        settings.LANGUAGE_CODE = 'fr'
51-        activate('none')
52-        response = self.client.get('/test_admin/admin/jsi18n/')
53-        self.assertContains(response, 'Choisir une heure')
54-        deactivate()
55-        settings.LANGUAGE_CODE = old_language_code
56-
57 
58 class SaveAsTests(TestCase):
59     fixtures = ['admin-views-users.xml','admin-views-person.xml']
60diff --git a/tests/regressiontests/views/app1/__init__.py b/tests/regressiontests/views/app1/__init__.py
61new file mode 100644
62--- /dev/null
63+++ b/tests/regressiontests/views/app1/__init__.py
64@@ -0,0 +1,1 @@
65+#
66diff --git a/tests/regressiontests/views/app1/locale/fr/LC_MESSAGES/djangojs.mo b/tests/regressiontests/views/app1/locale/fr/LC_MESSAGES/djangojs.mo
67new file mode 100644
68index 0000000000000000000000000000000000000000..5d6aecb446f3b0b907f540596f8268833603678b
69GIT binary patch
70literal 482
71zc$`g<!A{#i5QYtEFFy9nVGg~~q281Ta8ray42o)pG;z2u_Fxu;U2AuO=!5hfIH0}+
72z@6l)JSRlbjpLS;T@9e*`|2}>A6G?0fJHi*?qcDnIVlI3ZehI^^D7x=g;YsqXSIu_x
73zF8Ia-&|Rk>us5~^DcQjl0efx3S~E4#+`C(<8K(_ik`Kn&6z19ZXLg>$WxiNWFJ|$A
74zI_DY7(3%EMH*LVmr4Y|ADja*#EQfF+-BK7N$pI!usD_}9QZ?L7WJiR!pnDVE>r{ft
75z5Y+(GAl+A(d=p)v17r2-&G{70Rz(4`tjuAQm)W#9$tIIUzFZ!Q)V3Sl5>}+|QYf<7
76z`Kq@(DvFb}*>k=<j>~D8zdcIrCGpr<CM$RR?!*Ms1Apz-+Su<<-)J9*f2^uAJbcsj
77zUarYwZfn=b2vaz`G8{){4cB_Z{UDo-@dPz7Q{UzJuO(<C)n3>9{OBq4W&aJ)e+vDC
78AssI20
79
80diff --git a/tests/regressiontests/views/app1/locale/fr/LC_MESSAGES/djangojs.po b/tests/regressiontests/views/app1/locale/fr/LC_MESSAGES/djangojs.po
81new file mode 100644
82--- /dev/null
83+++ b/tests/regressiontests/views/app1/locale/fr/LC_MESSAGES/djangojs.po
84@@ -0,0 +1,20 @@
85+# SOME DESCRIPTIVE TITLE.
86+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
87+# This file is distributed under the same license as the PACKAGE package.
88+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
89+#
90+#, fuzzy
91+msgid ""
92+msgstr ""
93+"Project-Id-Version: PACKAGE VERSION\n"
94+"Report-Msgid-Bugs-To: \n"
95+"POT-Creation-Date: 2007-09-15 19:15+0200\n"
96+"PO-Revision-Date: 2010-05-12 12:41-0300\n"
97+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
98+"Language-Team: LANGUAGE <LL@li.org>\n"
99+"MIME-Version: 1.0\n"
100+"Content-Type: text/plain; charset=UTF-8\n"
101+"Content-Transfer-Encoding: 8bit\n"
102+
103+msgid "this app1 string is to be translated"
104+msgstr "il faut traduire cette chaîne de caractères de app1"
105diff --git a/tests/regressiontests/views/app2/__init__.py b/tests/regressiontests/views/app2/__init__.py
106new file mode 100644
107--- /dev/null
108+++ b/tests/regressiontests/views/app2/__init__.py
109@@ -0,0 +1,1 @@
110+#
111diff --git a/tests/regressiontests/views/app2/locale/fr/LC_MESSAGES/djangojs.mo b/tests/regressiontests/views/app2/locale/fr/LC_MESSAGES/djangojs.mo
112new file mode 100644
113index 0000000000000000000000000000000000000000..17e18636727c1801f37cea95e3fd15d95e2b4234
114GIT binary patch
115literal 482
116zc$`g<!A`?442BDWOOKp6_`nSUZP5gjfhb!+6YUsV$33*B1dXIhya^tJci@0{3EqQe
117z!4;rk=~I43e;mj8+E{z_I98cWW`|j4y53KWm@Vdp>8yC(qFtGH)+^pJR{sP&C<n4>
118zB5-7tu7OiBaECxvYB!UFl{d2H5la$-O5CD#%IFwIN$)DTOyM>iPX^aRe~gW>Byv})
119zN}SJYCkhjTKe{eN&!QwgB>G$}hA0RQL~ta+4unT>*x3$vhmB&43+4X%!axKa5k?S2
120zF^gcIeVKG5ir?Ohjp1UNWiU+g6uN1i46?JN-yf%w$thcPJ(o3#0_9T-Su(twwk>zF
121z>};lXjjd1pe2}NhM}@nA-!qy}^Bpe@H$nJJd(BKLeGKJ;v<~THT3m?3rLXPf9<4}q
122vX(}FJ42O4$d{52bUe2i<WHnb7p+q8Vt9*WFgo>rKvZT*9i>^)EZ}7eW4QGU{
123
124diff --git a/tests/regressiontests/views/app2/locale/fr/LC_MESSAGES/djangojs.po b/tests/regressiontests/views/app2/locale/fr/LC_MESSAGES/djangojs.po
125new file mode 100644
126--- /dev/null
127+++ b/tests/regressiontests/views/app2/locale/fr/LC_MESSAGES/djangojs.po
128@@ -0,0 +1,20 @@
129+# SOME DESCRIPTIVE TITLE.
130+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
131+# This file is distributed under the same license as the PACKAGE package.
132+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
133+#
134+#, fuzzy
135+msgid ""
136+msgstr ""
137+"Project-Id-Version: PACKAGE VERSION\n"
138+"Report-Msgid-Bugs-To: \n"
139+"POT-Creation-Date: 2007-09-15 19:15+0200\n"
140+"PO-Revision-Date: 2010-05-12 22:05-0300\n"
141+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
142+"Language-Team: LANGUAGE <LL@li.org>\n"
143+"MIME-Version: 1.0\n"
144+"Content-Type: text/plain; charset=UTF-8\n"
145+"Content-Transfer-Encoding: 8bit\n"
146+
147+msgid "this app2 string is to be translated"
148+msgstr "il faut traduire cette chaîne de caractères de app2"
149diff --git a/tests/regressiontests/views/app3/__init__.py b/tests/regressiontests/views/app3/__init__.py
150new file mode 100644
151--- /dev/null
152+++ b/tests/regressiontests/views/app3/__init__.py
153@@ -0,0 +1,1 @@
154+#
155diff --git a/tests/regressiontests/views/app3/locale/es_AR/LC_MESSAGES/djangojs.mo b/tests/regressiontests/views/app3/locale/es_AR/LC_MESSAGES/djangojs.mo
156new file mode 100644
157index 0000000000000000000000000000000000000000..0c485a9838f77e1ce20134ff06bc1d8ce01c66f8
158GIT binary patch
159literal 483
160zc$`&`!A`<J5QdA<OOKvC?8TD~wkQ!Q8Y&b+YyqKoU)!;+!QEzeG5Q2Pf$!kSH}J%J
161z_$*F?MxEr_nce)8nf*VvH(wo!4PuAbC$@-=vyKVTB(ADlbDS5-yTk|8weP-vAr|bG
162zFD<j0=S!iHWoRv(cYO6Ok>yl!%`>}t(`c$IFUvz`qSZZS7KS-oqc%dxfK9^QWq1*>
163z>u5R~jz{hkOQkI&rVu%tFAD>y3Ya??r_j^LEj2-(TMSsk^Nzu5gWqI+JMf!(9=(td
164zruZn#U!CuP*95=8{6=u(gLg=}m>UbJ=F%*<RXSjUc^tD*m_)1-CE+mchW-9Dn$6Bg
165zDvKpA5K`n10gJ=Y#k^X%6UW_!s4HEZxydkzem~{cJ-4T%MM*QBOIpI>lRYRGT*#Bk
166xC2i22&eH+3es$F@x2PeKnaYJM0@k__)^*U3vsJ(PF_Q8PGJ|^Ue<pI}d;y!`g%JP%
167
168diff --git a/tests/regressiontests/views/app3/locale/es_AR/LC_MESSAGES/djangojs.po b/tests/regressiontests/views/app3/locale/es_AR/LC_MESSAGES/djangojs.po
169new file mode 100644
170--- /dev/null
171+++ b/tests/regressiontests/views/app3/locale/es_AR/LC_MESSAGES/djangojs.po
172@@ -0,0 +1,20 @@
173+# SOME DESCRIPTIVE TITLE.
174+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
175+# This file is distributed under the same license as the PACKAGE package.
176+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
177+#
178+#, fuzzy
179+msgid ""
180+msgstr ""
181+"Project-Id-Version: PACKAGE VERSION\n"
182+"Report-Msgid-Bugs-To: \n"
183+"POT-Creation-Date: 2007-09-15 19:15+0200\n"
184+"PO-Revision-Date: 2010-05-12 12:41-0300\n"
185+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
186+"Language-Team: LANGUAGE <LL@li.org>\n"
187+"MIME-Version: 1.0\n"
188+"Content-Type: text/plain; charset=UTF-8\n"
189+"Content-Transfer-Encoding: 8bit\n"
190+
191+msgid "il faut traduire cette chaîne de caractères de app3"
192+msgstr "este texto de app3 debe ser traducido"
193diff --git a/tests/regressiontests/views/app4/__init__.py b/tests/regressiontests/views/app4/__init__.py
194new file mode 100644
195--- /dev/null
196+++ b/tests/regressiontests/views/app4/__init__.py
197@@ -0,0 +1,1 @@
198+#
199diff --git a/tests/regressiontests/views/app4/locale/es_AR/LC_MESSAGES/djangojs.mo b/tests/regressiontests/views/app4/locale/es_AR/LC_MESSAGES/djangojs.mo
200new file mode 100644
201index 0000000000000000000000000000000000000000..581fbb03471b1430adf64aa1950766bd14e4c1b1
202GIT binary patch
203literal 483
204zc$`g;!A`<J5QdA<OOKvC?8TD~wkQ!R5-Su!YyqKoU)rIr!QEzeG5Q2Pf$!kSH}K?p
205z_$*F?Mko1pW;g$2X8*6<?N^6li`XL$i5;TtY+^z*iJL0d9Os4dKJh_y?MJia{0p&S
206zOTM<uYM!r!MwX$qbl&mLcZn>gl53vX&o_;xy7IC-aVA>bV`gEP!!2qflnmG;>|Te1
207zh}}lh*>F5^r&ua&Au)x>;c8tNNL9ex$vB0sMsBGIdfZ~b8lHCw-Wm8!=AQ+A^T4AQ
208z62cT8h54`ZJ@A^~H<;fDPJHl=Nf&ctA=O-(6}L(UtUr%qHVTu7wWA~)#+PBQH;rbq
209z4oPLP<^@8E{2^d*I2z2WmD_QAxe|4yi;kNNlj!eLe%*7sN?MdO<GG|IEI!$za>a!_
210yuUygw?ZrIpL+ejh?XpA-k<3&sWD&5|LRi;9L(W$H>eooh3uFfM#{W#@%J~MJOobBw
211
212diff --git a/tests/regressiontests/views/app4/locale/es_AR/LC_MESSAGES/djangojs.po b/tests/regressiontests/views/app4/locale/es_AR/LC_MESSAGES/djangojs.po
213new file mode 100644
214--- /dev/null
215+++ b/tests/regressiontests/views/app4/locale/es_AR/LC_MESSAGES/djangojs.po
216@@ -0,0 +1,20 @@
217+# SOME DESCRIPTIVE TITLE.
218+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
219+# This file is distributed under the same license as the PACKAGE package.
220+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
221+#
222+#, fuzzy
223+msgid ""
224+msgstr ""
225+"Project-Id-Version: PACKAGE VERSION\n"
226+"Report-Msgid-Bugs-To: \n"
227+"POT-Creation-Date: 2007-09-15 19:15+0200\n"
228+"PO-Revision-Date: 2010-05-12 12:41-0300\n"
229+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
230+"Language-Team: LANGUAGE <LL@li.org>\n"
231+"MIME-Version: 1.0\n"
232+"Content-Type: text/plain; charset=UTF-8\n"
233+"Content-Transfer-Encoding: 8bit\n"
234+
235+msgid "il faut traduire cette chaîne de caractères de app4"
236+msgstr "este texto de app4 debe ser traducido"
237diff --git a/tests/regressiontests/views/locale/es/LC_MESSAGES/djangojs.mo b/tests/regressiontests/views/locale/es/LC_MESSAGES/djangojs.mo
238index 01c002e9e0e3878edd15a03a3d997c0e5124ef33..b6b088752a01696046502cda6205ccd9bccb6487
239GIT binary patch
240literal 490
241zc$`g;O-{ow5QSZSHj!Y#iUo_=BSTUMKLM(SHlT{6RBhTdrWsPB)-JY#;09cP>u>|E
242zz*(58m0;vgBU$f_pXX<1<C9UX6MMulu}P$CSr5b(A&6Z<6Jd?959-^*S8eJ0re0fl
243z)>eHnleH#VTLb}4&XBo@v_QvcctmhUC_5Dn3)VCG8OM%y3O+((rB)I2;?`Y!o4_dP
244z4?6c<ua9$W9M5bi3w~XdmghPGuXmsGmO<gj#M?A2g1YaYa{rtMAp|GUak%f(4GDQ4
245zU#0!83w-W}Jg7rZk3#YskuDY1@qCp{n+R@(X$svqOW-oe;!fI(+wFcb7&J(#%1V^T
246za}=`((zts&TtvQ1)8<qjXj3-4tdk{wp9&6qucehkMQ^;%DTKo}cQ~I4sV-nV5yqms
247z8s<0r>`%AI@`Q#bYOD*X$_UOLrSn)al_f%@1WdFM3@z=|NmK|g6@o>xSaDH}Wue(G
248DUSfgM
249
250diff --git a/tests/regressiontests/views/locale/es/LC_MESSAGES/djangojs.po b/tests/regressiontests/views/locale/es/LC_MESSAGES/djangojs.po
251--- a/tests/regressiontests/views/locale/es/LC_MESSAGES/djangojs.po
252+++ b/tests/regressiontests/views/locale/es/LC_MESSAGES/djangojs.po
253@@ -9,7 +9,7 @@
254 "Project-Id-Version: PACKAGE VERSION\n"
255 "Report-Msgid-Bugs-To: \n"
256 "POT-Creation-Date: 2007-09-15 16:45+0200\n"
257-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
258+"PO-Revision-Date: 2010-05-12 12:57-0300\n"
259 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
260 "Language-Team: LANGUAGE <LL@li.org>\n"
261 "MIME-Version: 1.0\n"
262@@ -18,4 +18,8 @@
263 
264 #: media/js/translate.js:1
265 msgid "this is to be translated"
266-msgstr "esto tiene que ser traducido"
267\ No newline at end of file
268+msgstr "esto tiene que ser traducido"
269+
270+
271+msgid "Choose a time"
272+msgstr "Elige una hora"
273diff --git a/tests/regressiontests/views/locale/fr/LC_MESSAGES/djangojs.mo b/tests/regressiontests/views/locale/fr/LC_MESSAGES/djangojs.mo
274index 4feca0b44d69463a63957c4869ca210ba7bce725..356147cf11c3f3a9765a75abba326f449f4c5bad
275GIT binary patch
276literal 484
277zc$`g;OHRWu5QbA8n@B8x4GR{tM*~Tr0>VRtHlT{6RBg%{(+sImuq)d^a04#DbvOej
278z;4Dm`QW^QvZ;k#LkLP=1<-_AxX119FW|c|3zqn`C7{P2YnrSsW@11p>`Q-a1>lbTd
279zUb8gUSx>J$(b^ISaPpZvH<1?jI1LX3&In~I;i&NXMnBQmVYk3LGFEC8K|gNa#McSj
280zC4*u2w&xFMs*S_Uma@Rhy0n<<2>kwSj%`E2aS?X7TLjG@IK<!>!xn_cQP|oEIKxI9
281z(2KPHePMt>3&SRa&FCP+V4r=dunzP2Y}!O{HA++H#aRNUNfvk0i@4JnB*Wo3TUA+$
282zk}xOn96=iQu1B+xPt)|GlDpcJ=YH1BlEtUO-N0{a<w)@xZ&Mz^(W~2=Rzj*17*B+;
283z<jzL<6&@{ovsoU=V4}vlkgAN}=s`Mvwp{*>fm#tvs5a!u3LZu6p!(fzQA^JK08zYu
284AnE(I)
285
286diff --git a/tests/regressiontests/views/locale/fr/LC_MESSAGES/djangojs.po b/tests/regressiontests/views/locale/fr/LC_MESSAGES/djangojs.po
287--- a/tests/regressiontests/views/locale/fr/LC_MESSAGES/djangojs.po
288+++ b/tests/regressiontests/views/locale/fr/LC_MESSAGES/djangojs.po
289@@ -9,7 +9,7 @@
290 "Project-Id-Version: PACKAGE VERSION\n"
291 "Report-Msgid-Bugs-To: \n"
292 "POT-Creation-Date: 2007-09-15 19:15+0200\n"
293-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
294+"PO-Revision-Date: 2010-05-12 12:41-0300\n"
295 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
296 "Language-Team: LANGUAGE <LL@li.org>\n"
297 "MIME-Version: 1.0\n"
298@@ -17,4 +17,8 @@
299 "Content-Transfer-Encoding: 8bit\n"
300 
301 msgid "this is to be translated"
302-msgstr "il faut le traduire"
303\ No newline at end of file
304+msgstr "il faut le traduire"
305+
306+
307+msgid "Choose a time"
308+msgstr "Choisir une heure"
309diff --git a/tests/regressiontests/views/locale/ru/LC_MESSAGES/djangojs.mo b/tests/regressiontests/views/locale/ru/LC_MESSAGES/djangojs.mo
310index 148cba533bfe58b81654c876767e3053988250f6..21659a93d3ed61229fb0d6cb100f64391ded2b28
311GIT binary patch
312literal 489
313zc$`g-&uZI15XRSOa}l(MoC@t>?qO5OjZ#PXLsVG_rjlc1+2^k9jl99pn%zxEZy~2b
314z4~0S>q^5!#iu(%dYY%;vjuS(&?2m64zM1{@-^TMF1kW?%4YG}_BMEsppO6;_LtY^g
315z@oR*9L4A$Pv3`mA7qzyUSzGCHCyB;VY7PvHxZuQ$g$BGv!hnNOtke@`_=t3rJm*70
316zTO-=%N()&A&<UfD;YkerIP11f+fK%(QW=`+LX7B#%R<v!2H<o~a~dhm3=YvIZVRC9
317zy6>sGOFbXFonYJFbg_d*n(-^4pZYwPx<2*l;MD^kXWpSNVcO7ql})Muj(bT0?J$jD
318zKTg9|auhb3S={X&qO~k8S;1+}*+l?J*gokkBkw24(L`)XRUA5LD~%sN<!!l6Bum3f
319zeB<*JLl}N--cBb>lzT87Go`sX=;g<>@#tG-Ipd1P<xq}9Sp?7+2;&g@eeu=)wAJFq
320b-Ysrz1$KsIWq&We5&P%9U)h<R+h62AFD#FK
321
322diff --git a/tests/regressiontests/views/locale/ru/LC_MESSAGES/djangojs.po b/tests/regressiontests/views/locale/ru/LC_MESSAGES/djangojs.po
323--- a/tests/regressiontests/views/locale/ru/LC_MESSAGES/djangojs.po
324+++ b/tests/regressiontests/views/locale/ru/LC_MESSAGES/djangojs.po
325@@ -9,7 +9,7 @@
326 "Project-Id-Version: PACKAGE VERSION\n"
327 "Report-Msgid-Bugs-To: \n"
328 "POT-Creation-Date: 2007-09-15 16:45+0200\n"
329-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
330+"PO-Revision-Date: 2010-05-12 12:57-0300\n"
331 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
332 "Language-Team: LANGUAGE <LL@li.org>\n"
333 "MIME-Version: 1.0\n"
334@@ -17,4 +17,8 @@
335 "Content-Transfer-Encoding: 8bit\n"
336 
337 msgid "this is to be translated"
338-msgstr "перевод"
339\ No newline at end of file
340+msgstr "перевод"
341+
342+
343+msgid "Choose a time"
344+msgstr "Выберите время"
345diff --git a/tests/regressiontests/views/tests/i18n.py b/tests/regressiontests/views/tests/i18n.py
346--- a/tests/regressiontests/views/tests/i18n.py
347+++ b/tests/regressiontests/views/tests/i18n.py
348@@ -1,8 +1,9 @@
349+# -*- coding:utf-8 -*-
350 import gettext
351 
352 from django.conf import settings
353 from django.test import TestCase
354-from django.utils.translation import activate
355+from django.utils.translation import activate, deactivate
356 from django.utils.text import javascript_quote
357 
358 from regressiontests.views.urls import locale_dir
359@@ -30,6 +31,7 @@
360             # javascript_quote is used to be able to check unicode strings
361             self.assertContains(response, javascript_quote(trans_txt), 1)
362 
363+
364 class JsI18NTests(TestCase):
365     """
366     Tests django views in django/views/i18n.py that need to change
367@@ -66,3 +68,70 @@
368         activate('fi')
369         response = self.client.get('/views/jsi18n/')
370         self.assertContains(response, 'il faut le traduire')
371+
372+    def testI18NLanguageNonEnglishDefault(self):
373+        """
374+        Check if the Javascript i18n view returns an empty language catalog
375+        if the default language is non-English but the selected language
376+        is English. See #13388 and #3594 for more details.
377+        """
378+        settings.LANGUAGE_CODE = 'fr'
379+        activate('en-us')
380+        response = self.client.get('/views/jsi18n/')
381+        self.assertNotContains(response, 'Choisir une heure')
382+        deactivate()
383+
384+    def testI18NLanguageNonEnglishFallback(self):
385+        """
386+        Makes sure that the fallback language is still working properly
387+        in cases where the selected language cannot be found.
388+        """
389+        settings.LANGUAGE_CODE = 'fr'
390+        activate('none')
391+        response = self.client.get('/views/jsi18n/')
392+        self.assertContains(response, 'Choisir une heure')
393+        deactivate()
394+
395+
396+class JsI18NTestsMultiPackage(TestCase):
397+    """
398+    Tests for django views in django/views/i18n.py that need to change
399+    settings.LANGUAGE_CODE and merge JS translation from several packages.
400+    """
401+
402+    def setUp(self):
403+        self.old_language_code = settings.LANGUAGE_CODE
404+        self.old_installed_apps = settings.INSTALLED_APPS
405+
406+    def tearDown(self):
407+        settings.LANGUAGE_CODE = self.old_language_code
408+        settings.INSTALLED_APPS = self.old_installed_apps
409+
410+    def testI18NLanguageEnglishDefault(self):
411+        """
412+        Check if the JavaScript i18n view returns a complete language catalog
413+        if the default language is en-us, the selected language has a
414+        translation available and a catalog composed by djangojs domain
415+        translations of multiple Python packages is requested. See #13388,
416+        #3594 and #13514 for more details.
417+        """
418+        settings.LANGUAGE_CODE = 'en-us'
419+        settings.INSTALLED_APPS = list(settings.INSTALLED_APPS) + ['regressiontests.views.app1', 'regressiontests.views.app2']
420+        activate('fr')
421+        response = self.client.get('/views/jsi18n_multi_packages1/')
422+        #print response.content
423+        self.assertContains(response, javascript_quote('il faut traduire cette chaîne de caractères de app1'))
424+        deactivate()
425+
426+    def testI18NDifferentNonEnLangs(self):
427+        """
428+        Similar to above but with neither default or requested language being
429+        English.
430+        """
431+        settings.LANGUAGE_CODE = 'fr'
432+        settings.INSTALLED_APPS = list(settings.INSTALLED_APPS) + ['regressiontests.views.app3', 'regressiontests.views.app4']
433+        activate('es-ar')
434+        response = self.client.get('/views/jsi18n_multi_packages2/')
435+        #print response.content
436+        self.assertContains(response, javascript_quote('este texto de app3 debe ser traducido'))
437+        deactivate()
438diff --git a/tests/regressiontests/views/urls.py b/tests/regressiontests/views/urls.py
439--- a/tests/regressiontests/views/urls.py
440+++ b/tests/regressiontests/views/urls.py
441@@ -16,6 +16,16 @@
442     'packages': ('regressiontests.views',),
443 }
444 
445+js_info_dict_multi_packages1 = {
446+    'domain': 'djangojs',
447+    'packages': ('regressiontests.views.app1', 'regressiontests.views.app2'),
448+}
449+
450+js_info_dict_multi_packages2 = {
451+    'domain': 'djangojs',
452+    'packages': ('regressiontests.views.app3', 'regressiontests.views.app4'),
453+}
454+
455 date_based_info_dict = {
456     'queryset': Article.objects.all(),
457     'date_field': 'date_created',
458@@ -36,6 +46,8 @@
459     # i18n views
460     (r'^i18n/', include('django.conf.urls.i18n')),
461     (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
462+    (r'^jsi18n_multi_packages1/$', 'django.views.i18n.javascript_catalog', js_info_dict_multi_packages1),
463+    (r'^jsi18n_multi_packages2/$', 'django.views.i18n.javascript_catalog', js_info_dict_multi_packages2),
464 
465     # Static views
466     (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': media_dir}),