如何在 TYPO3 中用不同的语言定义不同的 URL-segments(路线)?

How to define different URL-segments (routes) in different language in TYPO3?

我正在使用 config.yaml 中的路由为我自己在当前 TYPO3 10 中的扩展提供漂亮的 URL,如下所示:

routes:
   -
     routePath: 'search'
     _controller: 'MyModule::all'

现在我想根据当前语言使用不同的 routePaths。这意味着 f.e.

   routePath: 'suche'

如果用户使用的是德文版网站。

如有任何提示如何在 config.yaml 中实现,我将不胜感激。

你可以从一个方面解决这个问题:

routes:
  - routePath: '/{locale-search}'
    _controller: 'MyModule::all'
aspects:
  locale-search:
    type: LocaleModifier
    default: 'search'
    localeMap:
      - locale: 'de_DE.*'
        value: 'suche'

来源:TYPO3 explained