当前位置: 首页>>代码示例>>Python>>正文


Python setup.SetupMultilingualSite类代码示例

本文整理汇总了Python中plone.app.multilingual.browser.setup.SetupMultilingualSite的典型用法代码示例。如果您正苦于以下问题:Python SetupMultilingualSite类的具体用法?Python SetupMultilingualSite怎么用?Python SetupMultilingualSite使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SetupMultilingualSite类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setupLanguage

def setupLanguage(context):
    logger("Creating language-dependent content")
    l = context.getSite()
    lu = getToolByName(l, 'portal_languages')
    setupTool = SetupMultilingualSite()
    data = (
        (
            "en",
            u"Rudd-O.com in English",
            u"Linux, free software, voluntaryism and cypherpunk.  Established 1999.",
        ),
        (
            "es",
            u"Rudd-O.com en español",
            u"Linux, software libre, voluntarismo y cypherpunk.  Desde 1999.",
        ),
    )
    for code, title, desc in data:
        if code not in [x[0] for x in lu.listSupportedLanguages()]:
            logger("Adding support for language code %s", code)
            lu.addSupportedLanguage(code)
            setupTool.setupSite(l)
            setupTool.setupLanguageSwitcher()
    for code, title, desc in data:
        l[code].setTitle(title)
        l[code].setDescription(desc)
    logger("Language-dependent content created")
开发者ID:Rudd-O,项目名称:Rudd-O.com,代码行数:27,代码来源:setupHandlers.py

示例2: init_content

def init_content(context):
    portal = api.portal.get()
    setupTool = SetupMultilingualSite()
    setupTool.setupSite(portal)
    setupTool.move_default_language_content()
    for lang in ['fr', 'en', 'it']:
        create_cover(portal[lang])
开发者ID:makinacorpus,项目名称:phenology.plone,代码行数:7,代码来源:upgrades.py

示例3: setUp

def setUp():
    portal = getSite()
    applyProfile(portal, 'plone.multilingualbehavior:default')

    language_tool = getToolByName(portal, 'portal_languages')
    language_tool.addSupportedLanguage('ca')
    language_tool.addSupportedLanguage('es')

    workflowTool = getToolByName(portal, "portal_workflow")
    workflowTool.setDefaultChain('simple_publication_workflow')

    setupTool = SetupMultilingualSite()
    setupTool.setupSite(portal)

    transaction.commit()

    atdoc = makeContent(portal['en'], 'Document', id='atdoc', title='EN doc')
    atdoc.setLanguage('en')
    atdoc_ca = makeTranslation(atdoc, 'ca')
    atdoc_ca.edit(title="CA doc", language='ca')

    dxdoc = createContentInContainer(portal['en'], "dxdoc", id="dxdoc", title='EN doc')
    ILanguage(dxdoc).set_language('en')
    dxdoc_ca = makeTranslation(dxdoc, 'ca')
    dxdoc_ca.title = "CA doc"
    ILanguage(dxdoc_ca).set_language('ca')

    transaction.commit()
开发者ID:savoirfairelinux,项目名称:plone.app.multilingual,代码行数:28,代码来源:test_robot.py

示例4: setUpPAMFolders

 def setUpPAMFolders(self):
     workflowTool = getToolByName(self.portal, "portal_workflow")
     workflowTool.setDefaultChain('simple_publication_workflow')
     setupTool = SetupMultilingualSite()
     setupTool.setupSite(self.portal)
     transaction.commit()
     return workflowTool
开发者ID:khink,项目名称:plone.app.multilingual,代码行数:7,代码来源:test_selector.py

示例5: setUp

    def setUp(self):
        self.portal = self.layer['portal']

        # Setup multilingual site
        language_tool = getToolByName(self.portal, 'portal_languages')
        language_tool.addSupportedLanguage('it')
        language_tool.addSupportedLanguage('de')
        setupTool = SetupMultilingualSite()
        setupTool.setupSite(self.portal)

        # Setup test browser
        self.browser = Browser(self.layer['app'])
        self.browser.handleErrors = False
        self.browser.addHeader(
            'Authorization', 'Basic %s:%s' % (
                SITE_OWNER_NAME, SITE_OWNER_PASSWORD))

        # Create sample document in 'en' and index it into catalog
        self.container = self.portal['en']
        self.content_id = self.container.invokeFactory(
            type_name="Document", id="sampledocument-form")
        self.content = self.container[self.content_id]
        self.content.setLanguage('en')
        notify(ObjectAddedEvent(self.content))

        import transaction
        transaction.commit()
开发者ID:fredvd,项目名称:plone.app.multilingual,代码行数:27,代码来源:test_form.py

示例6: post_install

def post_install(setup):
    """Post install script"""
    if setup.readDataFile('plonedemosite_default.txt') is None:
        return
    portal = api.portal.get()
    remove_content(portal)
    create_demo_users()
    languages = api.portal.get_registry_record('plone.available_languages')
    setupTool = SetupMultilingualSite()
    setupTool.setupSite(portal)
    for language in languages:
        container = portal[language]

        # Create frontpage for language
        frontpage = create_frontpage(
            portal, container=container, target_language=language)
        container.setDefaultPage('frontpage')
        ILanguage(frontpage).set_language(language)

        # Link the new frontpage as a translation to all existing items
        for lang in languages:
            existing_frontpage = portal[lang].get('frontpage')
            if existing_frontpage:
                ITranslationManager(existing_frontpage).register_translation(
                    language, frontpage)

        # Import zexp for language
        import_zexp(
            setup,
            filename='demo_%s.zexp' % language,
            container=container,
            name='demo',
            update=True,
            publish=True,
        )
开发者ID:uabaroholka2016,项目名称:demo.plone.de,代码行数:35,代码来源:setuphandlers.py

示例7: setUpPloneSite

 def setUpPloneSite(self, portal):
     applyProfile(portal, 'plone.app.multilingual:default')
     setRoles(portal, TEST_USER_ID, ['Manager'])
     login(portal, TEST_USER_NAME)
     language_tool = getToolByName(portal, 'portal_languages')
     language_tool.addSupportedLanguage('fr')
     language_tool.addSupportedLanguage('it')
     setup_tool = SetupMultilingualSite()
     setup_tool.setupSite(portal)
开发者ID:plone,项目名称:plone.app.users,代码行数:9,代码来源:test_pam.py

示例8: setupMultilingual

def setupMultilingual(context):
    if context.readDataFile('osha.hwccontent.txt') is None:
        return
    portal = context.getSite()

    setupTool = SetupMultilingualSite()
    setupTool.setupSite(portal)

    setupTool.setupSharedFolder()
开发者ID:EU-OSHA,项目名称:osha.hwccontent,代码行数:9,代码来源:setuphandlers.py

示例9: handle_save_action

 def handle_save_action(self, action, data):
     CheckAuthenticator(self.request)
     if form.applyChanges(self.context, self.form_fields, data, self.adapters):
         self.status = _Plone("Changes saved.")
         self._on_save(data)
     else:
         self.status = _Plone("No changes made.")
     setupTool = SetupMultilingualSite()
     output = setupTool.setupSite(self.context)
     self.status += output
开发者ID:headnet,项目名称:plone.app.multilingual,代码行数:10,代码来源:controlpanel.py

示例10: setUp

    def setUp(self):
        with ploneSite() as portal:
            # Define available languages
            language_tool = getToolByName(portal, 'portal_languages')
            language_tool.addSupportedLanguage('ca')
            language_tool.addSupportedLanguage('es')

            # Setup language root folders
            setupTool = SetupMultilingualSite()
            setupTool.setupSite(portal)
开发者ID:martior,项目名称:plone.app.multilingual,代码行数:10,代码来源:testing.py

示例11: setUp

    def setUp(self):
        self.portal = self.layer['portal']
        self.portal.error_log._ignored_exceptions = ()
        self.request = self.layer['request']
        self.portal_url = self.portal.absolute_url()
        self.language_tool = getToolByName(self.portal, 'portal_languages')
        self.language_tool.addSupportedLanguage('ca')
        self.language_tool.addSupportedLanguage('es')

        setupTool = SetupMultilingualSite()
        setupTool.setupSite(self.portal)
开发者ID:fredvd,项目名称:plone.app.multilingual,代码行数:11,代码来源:test_alternates.py

示例12: setUp

 def setUp(self):
     self.portal = self.layer['portal']
     self.request = self.layer['request']
     self.language_tool = getToolByName(self.portal, 'portal_languages')
     self.language_tool.addSupportedLanguage('ca')
     self.language_tool.addSupportedLanguage('es')
     setRoles(self.portal, TEST_USER_ID, ['Manager'])
     login(self.portal, TEST_USER_NAME)
     workflowTool = getToolByName(self.portal, "portal_workflow")
     workflowTool.setDefaultChain('simple_publication_workflow')
     setupTool = SetupMultilingualSite()
     setupTool.setupSite(self.portal)
开发者ID:fredvd,项目名称:plone.app.multilingual,代码行数:12,代码来源:test_helper_views.py

示例13: test_add_all_supported_languages

    def test_add_all_supported_languages(self):
        """ There was a language which code is 'id'
            and it broke the root language folder setup process
        """
        language_tool = getToolByName(self.portal, 'portal_languages')
        for lang in AllContentLanguageVocabulary()(self.portal):
            language_tool.addSupportedLanguage(lang.value)

        workflowTool = getToolByName(self.portal, "portal_workflow")
        workflowTool.setDefaultChain('simple_publication_workflow')

        setupTool = SetupMultilingualSite()
        setupTool.setupSite(self.portal)
开发者ID:pingviini,项目名称:plone.app.multilingual,代码行数:13,代码来源:test_setup.py

示例14: setUp

    def setUp(self):
        with ploneSite() as portal:
            # Define available languages
            language_tool = getToolByName(portal, "portal_languages")
            language_tool.addSupportedLanguage("ca")
            language_tool.addSupportedLanguage("es")

            # Enable request negotiator
            language_tool.use_request_negotiation = True

            # Setup language root folders
            setupTool = SetupMultilingualSite()
            setupTool.setupSite(portal)
开发者ID:urska19,项目名称:Plone-test,代码行数:13,代码来源:testing.py

示例15: setUp

    def setUp(self):
        self.portal = self.layer["portal"]
        self.request = self.layer["request"]
        alsoProvides(self.request, IPloneAppMultilingualInstalled)
        language_tool = getToolByName(self.portal, "portal_languages")
        language_tool.addSupportedLanguage("ca")
        language_tool.addSupportedLanguage("es")

        workflowTool = getToolByName(self.portal, "portal_workflow")
        workflowTool.setDefaultChain("simple_publication_workflow")

        setupTool = SetupMultilingualSite()
        setupTool.setupSite(self.portal)
开发者ID:khink,项目名称:plone.app.multilingual,代码行数:13,代码来源:test_lrf.py


注:本文中的plone.app.multilingual.browser.setup.SetupMultilingualSite类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。