示例#1
0
 def test_set_active_bundle_name(self):
     # Verifies that get_localized and get_rendered are properly affected
     # by set_active_bundle_name.
     self.put_resource('1', 'xyz', 0, 'one')
     self.put_resource('2', 'xyz', 0, 'two')
     assert resources.get_localized('xyz', 'en').content == 'one'
     assert resources.get_rendered('xyz', 'en') == 'one'
     resources.set_active_bundle_name('2')
     assert resources.get_localized('xyz', 'en').content == 'two'
     assert resources.get_rendered('xyz', 'en') == 'two'
     resources.set_active_bundle_name('1')
     assert resources.get_localized('xyz', 'en').content == 'one'
     assert resources.get_rendered('xyz', 'en') == 'one'
示例#2
0
 def test_set_active_bundle_name(self):
     # Verifies that get_localized and get_rendered are properly affected
     # by set_active_bundle_name.
     self.put_resource('1', 'xyz', 0, 'one')
     self.put_resource('2', 'xyz', 0, 'two')
     assert resources.get_localized('xyz', 'en').content == 'one'
     assert resources.get_rendered('xyz', 'en') == 'one'
     resources.set_active_bundle_name('2')
     assert resources.get_localized('xyz', 'en').content == 'two'
     assert resources.get_rendered('xyz', 'en') == 'two'
     resources.set_active_bundle_name('1')
     assert resources.get_localized('xyz', 'en').content == 'one'
     assert resources.get_rendered('xyz', 'en') == 'one'
 def test_set_active_bundle_name(self):
     # Verifies that get_localized and get_rendered are properly affected
     # by set_active_bundle_name.
     self.put_resource("1", "xyz", 0, "one")
     self.put_resource("2", "xyz", 0, "two")
     assert resources.get_localized("xyz", "en").content == "one"
     assert resources.get_rendered("xyz", "en") == "one"
     resources.set_active_bundle_name("2")
     assert resources.get_localized("xyz", "en").content == "two"
     assert resources.get_rendered("xyz", "en") == "two"
     resources.set_active_bundle_name("1")
     assert resources.get_localized("xyz", "en").content == "one"
     assert resources.get_rendered("xyz", "en") == "one"
示例#4
0
 def load_template(self, name, dirs):
     import resources
     lang = django.utils.translation.get_language()  # currently active lang
     resource = resources.get_localized(name, lang)
     template = resource and resource.get_template()
     if template:
         return template, name + ':' + lang
     else:
         raise django.template.TemplateDoesNotExist(name)
 def get_template(self, name, template_dirs=None, skip=None):
     import resources
     lang = django.utils.translation.get_language()  # currently active lang
     resource = resources.get_localized(name, lang)
     template = resource and resource.get_template()
     if template:
         return template
     else:
         raise django.template.TemplateDoesNotExist(name)
示例#6
0
 def load_template(self, name, dirs):
     import resources
     lang = django.utils.translation.get_language()  # currently active lang
     resource = resources.get_localized(name, lang)
     template = resource and resource.get_template()
     if template:
         return template, name + ':' + lang
     else:
         raise django.template.TemplateDoesNotExist(name)