本文整理汇总了Python中plone.app.multilingual.browser.setup.SetupMultilingualSite.setupLanguageSwitcher方法的典型用法代码示例。如果您正苦于以下问题:Python SetupMultilingualSite.setupLanguageSwitcher方法的具体用法?Python SetupMultilingualSite.setupLanguageSwitcher怎么用?Python SetupMultilingualSite.setupLanguageSwitcher使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plone.app.multilingual.browser.setup.SetupMultilingualSite
的用法示例。
在下文中一共展示了SetupMultilingualSite.setupLanguageSwitcher方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupLanguage
# 需要导入模块: from plone.app.multilingual.browser.setup import SetupMultilingualSite [as 别名]
# 或者: from plone.app.multilingual.browser.setup.SetupMultilingualSite import setupLanguageSwitcher [as 别名]
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")