def test_no_potfile_with_missing_translations(self):
        fshelpers.create_structure(self.tempdir, {
                'foo/foo/profiles/default/content_creation/content.json':
                        fshelpers.asset('untranslated_content.json'),
                    })

        rebuild_pot(self.potfile, self.profiles_dir, self.domain)

        self.assertFalse(os.path.exists(self.potfile))
    def test_extract_messages(self):
        potfile = os.path.join(self.tempdir, 'somedir', 'inflator.pot')
        fshelpers.create_structure(self.tempdir, {
                'foo/foo/profiles/default/content_creation/content.json':
                        fshelpers.asset('translated_content.json'),
                    })
        self.assertFalse(os.path.exists(os.path.dirname(potfile)))

        rebuild_pot(potfile, self.profiles_dir, self.domain)

        self.assertTrue(os.path.exists(os.path.dirname(potfile)))
        messages = pohelpers.messages(potfile)
        self.assertTrue(os.path.exists(potfile))
        self.assertIn('Foo', messages)
    def test_no_potfile_with_missing_profiles_dir(self):
        fshelpers.create_structure(self.tempdir, {'foo/foo/__init__.py': ''})

        rebuild_pot(self.potfile, self.profiles_dir, self.domain)
        self.assertFalse(os.path.exists(self.potfile))
    def test_no_potfile_with_missing_inflator_content(self):
        fshelpers.create_structure(self.tempdir,
                        {os.path.join(self.profiles_dir, 'metadata.xml'): ''})

        rebuild_pot(self.potfile, self.profiles_dir, self.domain)
        self.assertFalse(os.path.exists(self.potfile))
예제 #5
0
def rebuild_inflator(package_dir, i18n_domain):
    potfile_name = '{}-content.pot'.format(i18n_domain)
    potfile = os.path.join(package_dir, 'locales', potfile_name)
    inflator.rebuild_pot(potfile, package_dir, i18n_domain)