简体   繁体   English

如何使用多树概念设置TYPO3 9.5.x语言

[英]How to setup TYPO3 9.5.x with a multiple-trees concept for languages

For a new website I have to setup a multiple languages TYPO3 9.5. 对于一个新网站,我必须设置多种语言TYPO3 9.5。 I have done this for previous versions, but don't get it to work with version 9.5. 我已经为以前的版本做过这个,但是不能让它与9.5版一起使用。 Have been searching for a couple of days now, without any result. 现在已经搜索了几天,没有任何结果。 All solutions are for older TYPO3's or one-tree concept. 所有解决方案均适用于较旧的TYPO3或单树概念。

The website has a structure like this: 该网站的结构如下:

  • Homepage (redirect to NL) 主页(重定向到NL)
    • NL (homepage with Dutch content) NL(主页荷兰语内容)
      • Algemeen Algemeen
      • Contact 联系
      • ... ...
    • DE (homepage with German content) DE(德语内容主页)
      • Allgemeine info Allgemeine信息
      • Kontakt KONTAKT
      • ... ...

The URL's: 网址:
- https://domain.tld/nl/ - https://domain.tld/nl/
- https://domain.tld/nl/algemeen/ - https://domain.tld/nl/algemeen/
- https://domain.tld/nl/contact/ - https://domain.tld/nl/contact/
- https://domain.tld/de/ - https://domain.tld/de/
- https://domain.tld/de/allgemeine-info/ - https://domain.tld/de/allgemeine-info/
- https://domain.tld/de/kontakt/ - https://domain.tld/de/kontakt/

The Homepage and DE part are the pages with all the TypoScript settings. 主页和DE部分是包含所有TypoScript设置的页面。
I don't want to translate the pages. 我不想翻译页面。 When you go to /nl/ everything is in Dutch and you are in the Dutch page tree when you go to /de/ everything is in German and you are in the German page tree. 当您转到/nl/所有内容都是荷兰语时,当您转到/de/所有内容都是德语时,您在荷兰语页面树中,并且您位于德语页面树中。

The same sort of site structure is used for other websites which have to be migrated from TYPO3 8.7 to 9.5 in the near future. 其他网站使用相同类型的网站结构,在不久的将来,这些网站必须从TYPO3 8.7迁移到9.5。

I've setup a new website and configured the website via Site Management -> Sites. 我已经设置了一个新网站,并通过网站管理 - >网站配置了网站。
The Root Page ID is set for the "Homepage". 根页面ID是为“主页”设置的。
In the Languages tab I have the default language Dutch (NL) with base /nl/ . 在语言选项卡中,我使用默认语言Dutch(NL)with base /nl/
And German (DE) with base /de/ . 德语(DE)与base /de/
No Error Handling and Static Routes are set at the moment. 此时没有设置错误处理和静态路由。

I have added an extension from another website with FLUID templates based on fluidpages and flux. 我已经从另一个网站添加了一个扩展,其中包含基于流体页和流量的FLUID模板。

I have tried setting the language via TypoScript (Setup) on /nl/ and /de/ . 我尝试在/nl//de/上通过TypoScript(Setup)设置语言。 But it is ignored. 但它被忽略了。 I guess that is because of TYPO3 9.5. 我猜这是因为TYPO3 9.5。
NL: NL:

config {
  language = nl
  locale_all = nl_NL.utf8
  sys_language_uid = 0
}

DE: DE:

config {
  language = de
  locale_all = de_DE.utf8
  sys_language_uid = 1
}

The standard slug of https://domain.tld/de/allgemeine-info/ is https://domain.tld/de/de/allgemeine-info/ in this setup. https://domain.tld/de/allgemeine-info/的标准https://domain.tld/de/de/allgemeine-info/在此设置中为https://domain.tld/de/de/allgemeine-info/ When I set the slug manually I can get what I want.. kind of, but then you have to set the slug for every page. 当我手动设置slug时,我可以得到我想要的东西..那种,但是你必须为每一页设置slug。 And I can also call https://domain.tld/de/nl/algemeen/ and https://domain.tld/nl/de/allgemeine-info/ which is not okay. 我也可以调用https://domain.tld/de/nl/algemeen/https://domain.tld/nl/de/allgemeine-info/这是不行的。

Is there a way to set the language via TypoScript only and not via Site Management, so I can create a multiple tree website? 有没有办法只通过TypoScript设置语言,而不是通过站点管理,所以我可以创建一个多树网站?

I hope someone can help me in the right direction. 我希望有人可以帮助我朝着正确的方向前进。

Thanks! 谢谢!

You could realize this scenario by creating two separate sites, one for each language: 您可以通过创建两个单独的站点来实现此方案,每个站点对应一种语言:

In your example you would tick the checkbox "Use as Root Page" in the page properties of the root pages of the two languages: 在您的示例中,您可以在两种语言的根页面的页面属性中勾选“用作根页面”复选框:

  • NL (homepage with Dutch content) NL(主页荷兰语内容)
  • DE (homepage with German content) DE(德语内容主页)

Then you create two site configurations. 然后,您创建两个站点配置。

For Dutch: 荷兰人:

rootPageId: <ID of NL page>
base: 'https://www.domain.tld/nl/'
baseVariants: {  }
languages:
  -
    title: Dutch
    enabled: true
    languageId: '0'
    base: /
    typo3Language: nl
    locale: nl_NL.utf8
    iso-639-1: nl
    navigationTitle: Dutch
    hreflang: nl-NL
    direction: ltr
    flag: nl
errorHandling: {  }
routes: {  }

And for German: 而对于德国人:

rootPageId: <ID of DE page>
base: 'https://www.domain.tld/en/'
baseVariants: {  }
languages:
  -
    title: English
    enabled: true
    languageId: '0'
    base: /
    typo3Language: default
    locale: en_US.utf8
    iso-639-1: en
    navigationTitle: English
    hreflang: en-US
    direction: ltr
    flag: us
errorHandling: {  }
routes: {  }

With this setup you do not need website language records because both trees would use the default language 0. 使用此设置,您不需要网站语言记录,因为两个树都将使用默认语言0。

You might need to add a third site for the root domain that redirects the user to the /nl pagetree. 您可能需要为根域添加第三个站点,将用户重定向到/nl pagetree。 The setup would be the same as for the dutch version except the page ID and the base setting would be different. 除了页面ID和base设置不同之外,设置将与荷兰版本相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM