當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。