Exemplo n.º 1
0
    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'), )])
Exemplo n.º 2
0
    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'),)])
Exemplo n.º 3
0
    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'), )])
Exemplo n.º 4
0
    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'),)])