def sync_package_pofiles(package_dir, languages):
    for group in discovery.discover_package(package_dir):
        if not group['pot']:
            continue

        langs = group['languages'].keys()
        if languages:
            langs += languages
        sync_pofile_group(package_dir, group, langs)
Exemplo n.º 2
0
def sync_package_pofiles(package_dir, languages):
    for group in discovery.discover_package(package_dir):
        if not group['pot']:
            continue

        langs = group['languages'].keys()
        if languages:
            langs += languages
        sync_pofile_group(package_dir, group, langs)
def rebuild_package_potfiles(package_root, package_dir, primary_domain):
    for group in discover_package(package_dir, None):
        if group['domain'] != primary_domain:
            continue

        manual = ''
        if group['manual']:
            manual = os.path.join(package_dir, group['manual'])

        content = ''
        if group['content']:
            content = os.path.join(package_dir, group['content'])

        potpath = os.path.join(package_dir, group['pot'])
        rebuild_pot(package_root, package_dir, primary_domain, potpath,
                    manual, content)
Exemplo n.º 4
0
def rebuild_package_potfiles(package_root, package_dir, primary_domain):
    for group in discover_package(package_dir, None):
        if group['domain'] != primary_domain:
            continue

        manual = ''
        if group['manual']:
            manual = os.path.join(package_dir, group['manual'])

        content = ''
        if group['content']:
            content = os.path.join(package_dir, group['content'])

        potpath = os.path.join(package_dir, group['pot'])
        rebuild_pot(package_root, package_dir, primary_domain, potpath, manual,
                    content)
    def test_discover_package(self):
        fshelpers.create_structure(self.tempdir, {
                u'foo/bar/locales/en/LC_MESSAGES/foo.bar.po': u'',
                u'foo/bar/locales/de/LC_MESSAGES/foo.bar.po': u'',
                u'foo/bar/locales/foo.bar.pot': u'',
                u'foo/bar/locales/foo.bar-manual.pot': u''})

        self.assertItemsEqual(
            [{u'domain': u'foo.bar',
              u'package': u'foo.bar',
              u'locales': u'foo/bar/locales',
              u'pot': u'foo/bar/locales/foo.bar.pot',
              u'manual': u'foo/bar/locales/foo.bar-manual.pot',
              u'content': None,
              u'languages': {
                        u'de': u'foo/bar/locales/de/LC_MESSAGES/foo.bar.po',
                        u'en': u'foo/bar/locales/en/LC_MESSAGES/foo.bar.po'}}
             ],

            discovery.discover_package(package_dir=self.tempdir,
                                       package_name='foo.bar'))
    def test_discover_package(self):
        fshelpers.create_structure(
            self.tempdir, {
                u'foo/bar/locales/en/LC_MESSAGES/foo.bar.po': u'',
                u'foo/bar/locales/de/LC_MESSAGES/foo.bar.po': u'',
                u'foo/bar/locales/foo.bar.pot': u'',
                u'foo/bar/locales/foo.bar-manual.pot': u''
            })

        self.assertItemsEqual([{
            u'domain': u'foo.bar',
            u'package': u'foo.bar',
            u'locales': u'foo/bar/locales',
            u'pot': u'foo/bar/locales/foo.bar.pot',
            u'manual': u'foo/bar/locales/foo.bar-manual.pot',
            u'content': None,
            u'languages': {
                u'de': u'foo/bar/locales/de/LC_MESSAGES/foo.bar.po',
                u'en': u'foo/bar/locales/en/LC_MESSAGES/foo.bar.po'
            }
        }],
                              discovery.discover_package(
                                  package_dir=self.tempdir,
                                  package_name='foo.bar'))