29 | | activate(lang_code) |
30 | | catalog = gettext.translation('djangojs', locale_dir, [lang_code]) |
31 | | trans_txt = catalog.ugettext('this is to be translated') |
32 | | response = self.client.get('/views/jsi18n/') |
33 | | # in response content must to be a line like that: |
34 | | # catalog['this is to be translated'] = 'same_that_trans_txt' |
35 | | # javascript_quote is used to be able to check unicode strings |
36 | | self.assertContains(response, javascript_quote(trans_txt), 1) |
37 | | if lang_code == 'fr': |
38 | | # Message with context (msgctxt) |
39 | | self.assertContains(response, "['month name\x04May'] = 'mai';", 1) |
| 29 | with override(lang_code): |
| 30 | catalog = gettext.translation('djangojs', locale_dir, [lang_code]) |
| 31 | trans_txt = catalog.ugettext('this is to be translated') |
| 32 | response = self.client.get('/views/jsi18n/') |
| 33 | # in response content must to be a line like that: |
| 34 | # catalog['this is to be translated'] = 'same_that_trans_txt' |
| 35 | # javascript_quote is used to be able to check unicode strings |
| 36 | self.assertContains(response, javascript_quote(trans_txt), 1) |
| 37 | if lang_code == 'fr': |
| 38 | # Message with context (msgctxt) |
| 39 | self.assertContains(response, "['month name\x04May'] = 'mai';", 1) |