0
votes

I have added an HMENU of type language, and some translations, and I can click the menu buttons to see the translations. However, there are a few things which are broken, and I'd like to get a more fundamental understanding.

The first thing which is strange: in the language menu the HREF for untranslated pages looks like e.g. /en/my-page, whereas the HREF for translated pages looks like /my-page?L=1. Wbat's going on here? I've put in the preVars section described in https://github.com/dmitryd/typo3-realurl/wiki/Notes-for-Integrators#configuring-languages. I would prefer it if the user never had to see the ?L=x query string parameter.

Edit: I have fixed this first issue by correcting my domain record from https://www.my.domain.com to www.my.domain.com, then clearing out the realurl database tables.

My second problem is my other normal HMENUs. The text in these is getting translated correctly, but the links are not - you end up going back to the default language every time you navigate.

Any help much appreciated.

I have tried all of the following:

  • 'Clear all cache' button
  • 'Clear PHP opcode cache' button
  • rm -rf /var/www/typo3temp/*
  • Delete contents of all the tx_realurl tables in the database

My 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
I think this happens with typo3 cache. You need to clear the all realurl table.Pravin Vavadiya

2 Answers

1
votes

You need to set config.linkVars to keep the language GET parameter in all links: https://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Config/Index.html#linkvars

Example (if you only have two languages):

config.linkVars = L(0-1)
1
votes

if realUrl does not render links like /<lng>/mypage.html and only mypage.html?L=<2>

  • check the path to your realurl config file, /see extension manager -> real Url -> setings where realurl is looking for it
  • check settings in extension manager realurl : is autoconfig enabled ?
  • check the domain settings records (sometimes rearl needs a domain record set)
  • check if the page with documentroot has the setting is document Root (helps realurl to generate a working realUrl autoconfig.

if you start from scratch with realurl, removing the autogenerated realurl config file, disable the extension and enablerealurl again sometimes helps after fixing bugs.