【问题标题】:In TYPO3, using RealURL, how do translated URLs work在 TYPO3 中,使用 RealURL,翻译后的 URL 是如何工作的
【发布时间】:2017-09-27 14:19:32
【问题描述】:

我添加了语言类型的 HMENU 和一些翻译,我可以单击菜单按钮查看翻译。但是,有一些东西被破坏了,我想得到一个更基本的理解。

首先奇怪的是:在语言菜单中,未翻译页面的 HREF 看起来像例如/en/my-page,而翻译页面的 HREF 看起来像 /my-page?L=1。 Wbat在这里进行吗?我已放入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。这些文本已正确翻译,但链接未正确翻译 - 每次导航时您最终都会返回默认语言。

非常感谢任何帮助。

我已经尝试了以下所有方法:

  • “清除所有缓存”按钮
  • “清除 PHP 操作码缓存”按钮
  • rm -rf /var/www/typo3temp/*
  • 删除数据库中所有tx_realurl表的内容

我的打字稿:

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
  }
}

【问题讨论】:

  • 我认为这发生在typo3缓存中。您需要清除所有 realurl 表。

标签: typo3 typo3-7.6.x realurl


【解决方案1】:

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

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

config.linkVars = L(0-1)

【讨论】:

  • 我已经包含了这个。我会将我的配置添加到问题中。
  • 在他的情况下应该是:config.linkVars = L(0-2),L(4),L(6-9)
【解决方案2】:

如果 realUrl 不呈现类似的链接 /&lt;lng&gt;/mypage.html 并且只有 mypage.html?L=&lt;2&gt;

  • 检查你的realurl配置文件的路径,/see extension manager -> real Url -> settings where realurl is looking for it
  • 检查扩展管理器 realurl 中的设置:是否启用了自动配置?
  • 检查域设置记录(有时重新需要一个域 记录集)
  • 检查带有documentroot的页面是否设置为document Root(帮助realurl生成有效的realUrl自动配置。

如果您从头开始使用 realurl,删除自动生成的 realurl 配置文件,禁用扩展并再次启用 realurl 有时会在修复错误后有所帮助。

【讨论】:

  • 感谢您的建议。我现在已经尝试了这些,但遗憾的是没有成功。
猜你喜欢
  • 2015-11-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-04-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多