def test_case5(self): """Test translation of an element content""" po = POFile(string='msgctxt "img[alt]"\n' 'msgid "The beach"\n' 'msgstr "La playa"') xhtml = XHTMLFile(string=self.template % '<img alt="The beach" src="beach.jpg" />') html = xhtml.translate(po) xhtml = XHTMLFile(string=html) messages = [unit[0] for unit in xhtml.get_units()] self.assertEqual(messages, [((TEXT, u'La playa'), )])
def test_case5(self): """Test translation of an element content""" po = POFile(string= 'msgctxt "img[alt]"\n' 'msgid "The beach"\n' 'msgstr "La playa"') xhtml = XHTMLFile(string= self.template % '<img alt="The beach" src="beach.jpg" />') html = xhtml.translate(po) xhtml = XHTMLFile(string=html) messages = [unit[0] for unit in xhtml.get_units()] self.assertEqual(messages, [((TEXT, u'La playa'),)])
def test_case4(self): """Test translation of an element content""" string = ('msgctxt "paragraph"\n' 'msgid "hello world"\n' 'msgstr "hola mundo"\n') p = POFile(string=string) string = self.template % '<p>hello world</p>' source = XHTMLFile(string=string) string = source.translate(p) xhtml = XHTMLFile(string=string) messages = [unit[0] for unit in xhtml.get_units()] self.assertEqual(messages, [((TEXT, u'hola mundo'), )])
def test_case4(self): """Test translation of an element content""" string = ( 'msgctxt "paragraph"\n' 'msgid "hello world"\n' 'msgstr "hola mundo"\n') p = POFile(string=string) string = self.template % '<p>hello world</p>' source = XHTMLFile(string=string) string = source.translate(p) xhtml = XHTMLFile(string=string) messages = [unit[0] for unit in xhtml.get_units()] self.assertEqual(messages, [((TEXT, u'hola mundo'),)])