Example #1
0
    def test_Contexts(self):
        """Test that message context in XPI file is set to chrome path."""
        queue_entry = self.setUpTranslationImportQueueForTranslation(
            'clashing_ids')
        importer = MozillaXpiImporter()
        template = importer.parse(queue_entry)

        messages = sorted([(message.msgid_singular, message.context,
                            message.singular_text)
                           for message in template.messages])
        self.assertEquals([
            (u'foozilla.clashing.key', u'mac/extra.dtd',
             u'This message is Mac-specific, and comes from DTD.'),
            (u'foozilla.clashing.key', u'mac/extra.properties',
             u'This message is Mac-specific, and comes from properties.'),
            (u'foozilla.clashing.key', u'main/main.dtd',
             u'This message is in the main DTD.'),
            (u'foozilla.clashing.key', u'main/main.properties',
             u'This message is in the main properties file.'),
            (u'foozilla.clashing.key', u'unix/extra.dtd',
             u'This message is Unix-specific, and comes from DTD.'),
            (u'foozilla.clashing.key', u'unix/extra.properties',
             u'This message is Unix-specific, and comes from properties.'),
            (u'foozilla.clashing.key', u'win/extra.dtd',
             u'This message is Windows-specific, and comes from DTD.'),
            (u'foozilla.clashing.key', u'win/extra.properties',
             u'This message is Windows-specific, '
             'and comes from properties.'),
            (u'foozilla.regular.message', u'main/main.dtd',
             u'A non-clashing message.'),
        ], messages)
    def test_GetLastTranslator(self):
        """Tests whether we extract last translator information correctly."""
        translation_entry = self.setUpTranslationImportQueueForTranslation(
            'en-US')
        importer = MozillaXpiImporter()
        translation_file = importer.parse(translation_entry)

        # Let's try with the translation file, it has valid Last Translator
        # information.
        name, email = translation_file.header.getLastTranslator()
        self.assertEqual(name, u'Carlos Perell\xf3 Mar\xedn')
        self.assertEqual(email, u'*****@*****.**')
    def test_GetLastTranslator(self):
        """Tests whether we extract last translator information correctly."""
        translation_entry = self.setUpTranslationImportQueueForTranslation(
            'en-US')
        importer = MozillaXpiImporter()
        translation_file = importer.parse(translation_entry)

        # Let's try with the translation file, it has valid Last Translator
        # information.
        name, email = translation_file.header.getLastTranslator()
        self.assertEqual(name, u'Carlos Perell\xf3 Mar\xedn')
        self.assertEqual(email, u'*****@*****.**')
    def test_Contexts(self):
        """Test that message context in XPI file is set to chrome path."""
        queue_entry = self.setUpTranslationImportQueueForTranslation(
            'clashing_ids')
        importer = MozillaXpiImporter()
        template = importer.parse(queue_entry)

        messages = sorted([
            (message.msgid_singular, message.context, message.singular_text)
            for message in template.messages])
        self.assertEquals(
            [
             (u'foozilla.clashing.key',
              u'mac/extra.dtd',
              u'This message is Mac-specific, and comes from DTD.'),
             (u'foozilla.clashing.key',
              u'mac/extra.properties',
              u'This message is Mac-specific, and comes from properties.'),
             (u'foozilla.clashing.key',
              u'main/main.dtd',
              u'This message is in the main DTD.'),
             (u'foozilla.clashing.key',
              u'main/main.properties',
              u'This message is in the main properties file.'),
             (u'foozilla.clashing.key',
              u'unix/extra.dtd',
              u'This message is Unix-specific, and comes from DTD.'),
             (u'foozilla.clashing.key',
              u'unix/extra.properties',
              u'This message is Unix-specific, and comes from properties.'),
             (u'foozilla.clashing.key',
              u'win/extra.dtd',
              u'This message is Windows-specific, and comes from DTD.'),
             (u'foozilla.clashing.key',
              u'win/extra.properties',
              u'This message is Windows-specific, '
                  'and comes from properties.'),
             (u'foozilla.regular.message',
              u'main/main.dtd',
              u'A non-clashing message.'),
            ],
            messages)