首页 文章

在TYPO3中,使用RealURL,翻译的URL如何工作

提问于
浏览
0

我添加了类型语言的HMENU和一些翻译,我可以单击菜单按钮查看翻译 . 然而,有一些事情被打破了,我希望得到一个更基本的理解 .

首先是奇怪的:在语言菜单中,未翻译页面的HREF看起来像是 /en/my-page ,而翻译页面的HREF看起来像 /my-page?L=1 . Wbat 's going on here? I'已放入https://github.com/dmitryd/typo3-realurl/wiki/Notes-for-Integrators#configuring-languages中描述的preVars部分 . 如果用户永远不必看到?L = x查询字符串参数,我更喜欢它 .

编辑:我已修复了第一个问题,将我的域记录从 https://www.my.domain.com 更正为 www.my.domain.com ,然后清除了realurl数据库表 .

我的第二个问题是我的其他普通HMENU . 这些文本正在被正确翻译,但链接不是 - 您每次导航时都会返回默认语言 .

任何帮助非常感谢 .

我尝试了以下所有方法:

  • 'Clear all cache'按钮

  • 'Clear PHP opcode cache'按钮

  • rm -rf / var / www / typo3temp / *

  • 删除数据库中所有tx_realurl表的内容

我的TypoScript:

config.doctype = html5
config.absRefPrefix = /
config.tx_realurl_enable = 1

## config.sys_language_overlay = 1 # I don't actually know what this does!
config.linkVars = L(0-9) # Make the language link variables work.

## Defaults
config.language = en
config.locale_all = en_GB.utf8
config.htmlTag_langKey = en-GB.utf8
config.sys_language_uid = 0

[globalVar = GP:L = 1]
config.language = da
config.locale_all = da_DA.utf8
config.htmlTag_langKey = da-DA.utf8
config.sys_language_uid = 1

[globalVar = GP:L = 2]
config.language = de
config.locale_all = de_DE.utf8
config.htmlTag_langKey = de-DE.utf8
config.sys_language_uid = 2

## There's no 3

[globalVar = GP:L = 4]
config.language = es
config.locale_all = es_ES.utf8
config.htmlTag_langKey = es-ES.utf8
config.sys_language_uid = 4

## There's no 5

[globalVar = GP:L = 6]
config.language = lv
config.locale_all = lv_LV.utf8
config.htmlTag_langKey = lv-LV.utf8
config.sys_language_uid = 6

[globalVar = GP:L = 7]
config.language = ro
config.locale_all = ro_RO.utf8
config.htmlTag_langKey = ro-RO.utf8
config.sys_language_uid = 7

[globalVar = GP:L = 8]
config.language = pl
config.locale_all = pl_PL.utf8
config.htmlTag_langKey = pl-PL.utf8
config.sys_language_uid = 8

[globalVar = GP:L = 9]
config.language = pt
config.locale_all = pt_PT.utf8
config.htmlTag_langKey = pt-PT.utf8
config.sys_language_uid = 9

[END]

## Language Menu
lib.language_menu = HMENU
lib.language_menu {
  special = language
  special.value = 0,1,2,4,6,7,8,9
  1 = TMENU
  1 {
      wrap = <ul class="language-menu">|</ul>
      noBlur = 1
      NO = 1
      NO {
         linkWrap = <li>|</li>
         stdWrap.override = En || Da || De || Es || Lv || Ro || Pl || Pt
      }

      ACT < .NO
      ACT {
          linkWrap = <li class="active">|</li>
      }

      # NO + Translation doesn't exist
      USERDEF1 < .NO
      # USERDEF1.doNotLinkIt = 1

      # ACT + Translation doesn't exist
      USERDEF2 < .ACT
      # USERDEF2.doNotLinkIt = 1
  }
}

2 回答

  • 1

    如果realUrl不呈现像 /<lng>/mypage.html 这样的链接而且只有 mypage.html?L=<2>

    • 检查你的realurl配置文件的路径,/请参阅扩展管理器 - >真实网址 - > seurs,其中realurl正在寻找它

    • 检查扩展管理器realurl中的设置:是否启用了autoconfig?

    • 检查域设置记录(有时后台需要域记录集)

    • 检查带有documentroot的页面是否设置为文档Root(帮助realurl生成有效的realUrl autoconfig .

    如果你从头开始使用realurl,删除自动生成的realurl配置文件,禁用扩展和再次启用有时有助于修复错误 .

  • 1

    您需要设置 config.linkVars 以在所有链接中保留语言GET参数:https://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Config/Index.html#linkvars

    示例(如果您只有两种语言):

    config.linkVars = L(0-1)
    

相关问题