def _addLocalizer(self):
        """ Add Localizer stuff """
        try:
            # old MessageCatalog
            self._setObject('gettext',
                            MessageCatalog('gettext', '', ('en', 'eu', 'es')))
        except:
            # new MessageCatalog
            self._setObject('gettext',
                    MessageCatalog('gettext', '', 'en', ['en', 'eu', 'es']))

        # fill the gettext with 'es' and 'eu' locales
        gettext = getattr(self, 'gettext')
        fillMessageCatalog(gettext)
        localizer = Localizer('Localizer', ('en',))
        localizer._v_hook = 1
        self._setObject('Localizer', localizer)
Esempio n. 2
0
    def _addMethods(self):
        """ Just to have all methods adding something extra
            to the ZMI together """
        file_path = Globals.package_home(globals())

        localizer = Localizer('Localizer', ('en', 'es', 'eu',))
        localizer._v_hook = 1
        self._setObject('Localizer', localizer)

        try:
            # old MessageCatalog
            self._setObject('gettext',
                    MessageCatalog('gettext', '', ('en', 'es', 'eu')))
        except:
            # new MessageCatalog
            self._setObject('gettext',
                    MessageCatalog('gettext', '', 'en', ['en', 'es', 'eu']))

        gettext = getattr(self, 'gettext')
        fillMessageCatalog(gettext)

        # Add a special tag.py script which makes use of traverse subpath
        self._setObject('tag', PythonScript('tag'))
        tag = getattr(self, 'tag')
        f = open(file_path + '/tag.py')
        data = f.read()
        f.close()
        tag.ZPythonScript_edit('', data)

        # Add a feed.xml file with the RSS feed
        addDTML(self, 'feed.xml', '', 'ui/feed.xml')

        # Add the CSS file
        self.manage_addFile('blog.css')
        css = getattr(self, 'blog.css')
        f = open(file_path + '/ui/blog.css')
        data = f.read()
        f.close()
        css.update_data(data)