I have set up a single-domain website with different languages and configured RealURL.
On one page, there is a FE plugin with list and show actions. The links from the list to the show action are rendered correctly, for example:
en/press.html -> en/press/release1.html
en/press.html -> en/press/release2.html
Clicking on one of the links surfaces the detail page - so far, so good. Everything works as expected.
However, the language switch returns the following links (on the detail page):
en/press.html
de/presse.html
The links, of course, should read as follows:
en/press/release1.html
de/presse/aussendung1.html
Also, the breadcrumb menu does not show the detail page; it reads Home > Press, regardless of whether I'm on the list or show action.
Language Nav
temp.langNav = COA
temp.langNav {
10 = HMENU
10 {
special = language
special.value = 0,1,2,3,4,5,6,7,8
special.normalWhenNoLanguage = 0
wrap = <ul class="lang-sel__list">|</ul>
1 = TMENU
1 {
noBlur = 1
NO = 1
NO {
allWrap = <li class="lang-sel__item">|</li>
ATagParams = class="lang-sel__link"
stdWrap.setCurrent = English || Deutsch || Русский || Česky || Polski || Français || Română || Hrvatski || Slovenčina
stdWrap.current = 1
}
USERDEF1 = 1
USERDEF1 {
doNotLinkIt = 1
stdWrap.cObject = TEXT
stdWrap.cObject.value =
}
}
}
}
temp.selectedLang = TEXT
temp.selectedLang.value < config.language
Breadcrumb Nav
temp.breadcrumbNav=COA
temp.breadcrumbNav {
10 = HMENU
10 {
special = rootline
special.range = 0|-1
includeNotInMenu = 1
wrap = |
1 = TMENU
1.noBlur = 1
1.CUR = 1
1.wrap = |
1.NO {
stdWrap.field = title
ATagParams = class="main-header__breadcrumb-link"
ATagTitle.field = nav_title // title
linkWrap = <li class="main-header__breadcrumb-item">|</li>
}
1.CUR {
stdWrap.field = title
linkWrap = <li class="main-header__breadcrumb-item">|</li>
doNotLinkIt = 1
}
}
}
RealURL Config
$TYPO3_CONF_VARS['FE']['addRootLineFields'].= ',tx_realurl_pathsegment';
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
'_DEFAULT' => array(
'init' => array(
'enableCHashCache' => 1,
'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
'postVarSet_failureMode' => '',
),
'redirects' => array(),
'preVars' => array(
array(
'GETvar' => 'L',
'valueMap' => array(
'en' => 0,
'de' => 1,
'ru' => 2,
'cz' => 3,
'pl' => 4,
'fr' => 5,
'ro' => 6,
'hr' => 7,
'sk' => 8
),
'valueDefault' => 'en',
),
),
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => 7,
'rootpage_id' => 1,
'firstHitPathCache' => 1,
),
'fixedPostVars' => array(
'_DEFAULT' => array(
array(
'GETvar' => 'press',
'lookUpTable' => array(
'table' => 'tx_myext_domain_model_press',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
),
'languageGetVar' => 'L',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
)
)
),
'fileName' => array(
'defaultToHTMLsuffixOnPrev' => 1
),
),
);
You need to tell TYPO3 to keep the parameters.
This is done by configuring addQueryString in the HMENU ConentObject.
Your example would be extended by:
temp.breadcrumbNav=COA
temp.breadcrumbNav {
10 = HMENU
10 {
1 {
NO {
addQueryString.exclude = L,cHash
}
}
}
}
For further information check the documentation:
docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Hmenu/Index.html and docs.typo3.org/typo3cms/TyposcriptReference/Functions/Typolink/Index.html
And the solution above can be found on forge: https://forge.typo3.org/issues/16466#note-3
Related
My realurl.conf contains the following:
'2' => array (
'GETvar' => 'L',
'valueMap' => array (
'en' => '1',
'nl' => '2',
'be-nl' => '3
'be-fr' => '4'
),
'noMatch' => 'bypass',
),
and:
array(
'GETvar' => 'L',
'value' => '3',
'urlPrepend' => 'http://www.example.be',
'useConfiguration' => 'www.example.be',
),
array(
'GETvar' => 'L',
'value' => '4',
'urlPrepend' => 'http://www.example.be/fr',
'useConfiguration' => 'www.example.be/fr',
),
and:
[globalVar= GP:L=4]
//french (Belgium) = 4
config{
sys_language_uid = 4
language = fr
htmlTag_setParams = lang="fr"
locale_all = fr_FR.UTF-8
sys_language_mode = content_fallback;4,8
}
page.bodyTagCObject.30.value = fr
[global]
In T3 backend the url "www.example.be/fr" is configured properly and content is there for the specific languages.
When I go to www.example.be/fr, I get the L-parameter 3 and the content for the language id 3. Could anyone help me out on this?
Hi in my typo3 8 website I've added a language chooser. Choosing a language works fine, content switches from german to english it works fine content switches properly.
Issue is when I click a link in english version it always falls back to the german link because /en/ is missing in the Link URL
URL in the Browser looks good the en is there, but in the navigation the URL to an page does not conatin en
I use Typo3 8 and realURL
Typoscript:
config {
sys_language_uid = 0
language = de
locale_all = de_DE.UTF-8
htmlTag_langKey = de
}
config.tx_realurl_enable = 1
[globalVar = GP:L = 1]
config {
sys_language_uid = 1
language = en
locale_all = en_US.UTF-8
htmlTag_langKey = en
}
[global]
temp.langMenu = HMENU
temp.langMenu.special = language
temp.langMenu.special.value = 0,1
temp.langMenu.1 = GMENU
temp.langMenu.1.NO {
XY = [5.w]+4, [5.h]+4
transparentColor = #17353e
backColor = #17353e
5 = IMAGE
5.file = fileadmin/design/images/flag_de.gif || fileadmin/design/images/flag_en.gif
}
temp.langMenu.1.ACT < lib.langMenu.1.NO
temp.langMenu.1.USERDEF1 < lib.langMenu.1.NO
temp.langMenu.1.USERDEF1 = 1
temp.langMenu.1.USERDEF1.5.file = fileadmin/design/images/flag_de.gif || fileadmin/design/images/flag_en.gif
temp.langMenu.1.USERDEF1.noLink = 1
RealURL Config:
<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']=array (
'_DEFAULT' =>
array (
'init' =>
array (
'appendMissingSlash' => 'ifNotFile,redirect',
'emptyUrlReturnValue' => '/',
),
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => 7,
'rootpage_id' => 1,
'firstHitPathCache' => 1,
),
'fileName' =>
array (
'defaultToHTMLsuffixOnPrev' => 0,
'acceptHTMLsuffix' => 1,
'index' =>
array (
'print' =>
array (
'keyValues' =>
array (
'type' => 98,
),
),
),
),
'preVars' =>
array (
0 =>
array (
'GETvar' => 'L',
'valueMap' => array(
'de' => '0',
'en' => '1',
),
'valueDefault' => 'de',
# 'noMatch' => 'bypass',
),
),
),
);
What is my fail in this case?
Thanks in Advance.
You need to add config.linkVars = L(0-1) to your Typoscript config. This will tell the TYPO3 system to pass this link parameter to each generated url.
Please note that this configuration will only apply to internal links generated by the TYPO3 system itself: For example in menues or when you link another page in the RTE. Absolutely placed links will not be affected by this configuration.
The docs: https://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Config/Index.html#linkvars
I use the following TypoScript to generate a language switcher. It's basically a copy from an existing site where everything works fine:
lib.langMenu = HMENU
lib.langMenu {
special = language
addQueryString = 1
special.value = 0,1
special.normalWhenNoLanguage = 0
1 = TMENU
1 {
noBlur = 1
NO = 1
NO {
allWrap = <li>|</li>
stdWrap2.noTrimWrap = | | |
stdWrap.override = Deutsch || English
ATagParams = class="lang-switcher-de" || class="lang-switcher-en"
}
ACT < .NO
ACT = 1
ACT.allWrap = <li class="active">|</li>
wrap = <ul class="pull-right language"><li class="hidden-xs">Language:</li>|</ul>
}
}
Now, I use the following RealURL setup:
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
'_DEFAULT' => array(
'init' => array(
'enableCHashCache' => 1,
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
),
'preVars' => array (
0 => array (
'GETvar' => 'L',
'valueMap' => array (
'en' => '1',
),
'noMatch' => 'bypass',
),
),
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
),
)
);
The issue is that, say I have the following pages, with their German and English path:
produkte / products
produktuebersicht / product_overview
When I'm on /produkte/produktuebersicht, the language switcher generates a link to/en/produkte/produktuebersicht instead of /en/products/product_overview. This problem occurs on every single page.
It always takes the path of the wrong (read, current) language. I've checked the ID to path mapping and it looks fine to me:
The encode cache has these entries – but even when I delete them the problem persists:
The weird thing is that the menu itself is generated correctly. So how can I make it link to the right RealURLs in the language switcher?
Your RealURL pagePath section should include a languageGetVar setting.
From the RealURL documentation:
Defines which GET variable in the URL that defines language id; if set the path will take this language value into account and try to generate the path in localized version.
Your pagePath section should look like:
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'languageGetVar' => 'L'
),
I´m running a Typo3 4.5.12 and the realurl extension verson 1.11.1.
My site has 3 languages de, en, ch and the default language is de, german.
If I clear the cache of realurl and call first www.example.com/site all is ok.
But if I call after clearCache first for example a url with language-param like www.example.com/en/site and after that www.example.com/site, all links get the ../en/.. in the href-tag like www.example.com/en/site2.
It´s the same when I call first after clearCache a site with ../ch/.. or ../de/..
Why he don´t pick the default-language when I call www.example.com/site in links?
My config of realurl:
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array(
init' => array(
'enableCHashCache' => 1,
'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
'respectSimulateStaticURLs' => 0,
),
'redirects_regex' => array (
),
'preVars' => array(
array(
'GETvar' => 'no_cache',
'valueMap' => array('no_cache' => 1),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'L',
'valueMap' => array(
'de' => '0',
'en' => '1',
'cn' => '2',
),
'defaultValue' => 'de',
'noMatch' => 'bypass',
),
),
...
My page config:
simulateStaticDocuments = 0
tx_realurl_enable = 1
prefixLocalAnchors = all
linkVars = mobile(off),L
uniqueLinkVars = 1
sys_language_uid = 0
language = de
locale_all = de_DE.UTF-8
sys_language_mode = content_fallback
sys_language_overlay = 1
[...]
'defaultValue' => 'de',
'noMatch' => 'bypass',
[...]
Are somewhat contra dictionary.
Take the noMatch out, this will create url's like:
/site1 (german)
/en/site1 (english)
/cn/site1 (chinese)
Otherwise go for
'noMatch' => 'de' //(without `'defaultValue' => 'de'`)
to get
/de/site1 (german)
/en/site1 (english)
/cn/site1 (chinese)
I'm using TYP 4.5.5, RealURL 1.11.2 and tt_news 3.0.1. I want that the user can switch the language and the corresponding news is shown in the users language. All should work with RealURL.
When switching language the news id is not submitted. So I have to explicitely submit the id. I found some threads which showed me how it could work, but I didn't get it managed. Here is my TS:
lib.tslangmenu = COA
lib.tslangmenu {
10 = HTML
10.value(
<img src="fileadmin/templates/images/languages_en.png" width="48" height="121" alt="Languages" />
<div id="LanguageContents">
)
20 = HMENU
20.special = language
20.wrap = <div id="AvailableLanguages">|</div>
20.special.value = 0,1
20.1 = GMENU
20.1.NO {
XY = 24,16
5 = IMAGE
5.file = fileadmin/templates/images/deutsch.png || fileadmin/templates/images/englisch.png
additionalParams.cObject = COA
additionalParams.cObject {
5 = TEXT
5.wrap = &L=1
10 = TEXT
10.data = GPvar : tx_ttnews | backPid
10.wrap = &tx_ttnews[backPid]=|
10.required = 1
20 = TEXT
20.data = GPvar : tx_ttnews | tt_news
20.wrap = &tx_tt_news[tt_news]=|
20.required = 1
30 = TEXT
30.data = GPvar : cHash
30.wrap = &cHash=|
30.required = 1
}
}
30 = HTML
30.value(
<img class="languagebutton" src="fileadmin/templates/images/languages_en.png" width="48" height="121" alt="Languages" />
</div>
)
According to the information I found I should use additionalParams and set the parameter with GPVar. But I always get the no news_id given message.
Here is my RealURL Config:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array (
'_DEFAULT' => array (
'init' => array (
'enableCHashCache' => '1',
'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => '1',
'enableUrlEncodeCache' => '1',
),
'redirects' => array (
),
'preVars' => array (
'0' => array (
'GETvar' => 'no_cache',
'valueMap' => array (
'nc' => '1',
),
'noMatch' => 'bypass'
),
'1' => array (
'GETvar' => 'L',
'valueMap' => array (
'de' => '0',
'en' => '1',
),
'valueDefault' => 'de',
'noMatch' => 'bypass',
),
'2' => array (
'GETvar' => 'lang',
'valueMap' => array (
'de' => 'de',
'en' => 'en',
),
'noMatch' => 'bypass',
),
),
'pagePath' => array (
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => '7',
'rootpage_id' => '1',
),
'fixedPostVars' => array (
),
'postVarSets' => array (
'_DEFAULT' => array (
'archive' => array (
'0' => array (
'GETvar' => 'tx_ttnews[year]',
),
'1' => array (
'GETvar' => 'tx_ttnews[month]',
'valueMap' => array (
'january' => '01',
'february' => '02',
'march' => '03',
'april' => '04',
'may' => '05',
'june' => '06',
'july' => '07',
'august' => '08',
'september' => '09',
'october' => '10',
'november' => '11',
'december' => '12',
),
),
),
'browse' => array (
'0' => array (
'GETvar' => 'tx_ttnews[pointer]',
),
),
'select_category' => array (
'0' => array (
'GETvar' => 'tx_ttnews[cat]',
),
),
'article' => array(
array(
'GETvar' => 'tx_ttnews[pointer]',
'valueMap' => array(),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_ttnews[tt_news]',
'lookUpTable' => array(
'table' => 'tt_news',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l18n_parent',
'autoUpdate' => 1,
'expireDays' => 180,
),
),
array (
'GETvar' => 'tx_ttnews[swords]',
),
),
),
),
Solution:
Seems that adding addQueryString does the job. Here is my final language switcher:
lib.tslangmenu = COA
lib.tslangmenu {
10 = HTML
10.value(
<img src="fileadmin/templates/images/languages.png" width="48" height="121" alt="Sprachen" />
<div id="LanguageContents">
)
20 = HMENU
20.special = language
20.wrap = <div id="AvailableLanguages">|</div>
20.special.value = 0,1
20.addQueryString = 1
20.1 = GMENU
20.1.NO {
XY = 24,16
5 = IMAGE
5.file = fileadmin/templates/images/deutsch.png || fileadmin/templates/images/englisch.png || fileadmin/templates/images/kroatisch.png
}
20.1.ACT < 20.1.NO
20.1.ACT = 1
20.1.ACT.wrap =<span class="langhide">|</span>
20.1.ACT {
XY = 24,16
5 = IMAGE
5.file = fileadmin/templates/images/deutsch.png || fileadmin/templates/images/englisch.png || fileadmin/templates/images/kroatisch.png
}
20.1.CUR < 20.1.ACT
20.1.CUR = 1
20.1.CUR{
XY = 24,16
5 = IMAGE
5.file = fileadmin/templates/images/deutsch.png || fileadmin/templates/images/englisch.png || fileadmin/templates/images/kroatisch.png
}
30 = HTML
30.value(
<img class="languagebutton" src="fileadmin/templates/images/languages.png" width="48" height="121" alt="Sprachen" />
</div>
)
}
Take a look at the following properties for your menu:
protectLvar
addQueryString <--- keeps the params to the string when switching languages.
TSREF is your friend:
http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/4.6.0/view/1/7/#id2635691
Your TypoScript has some errors:
20.wrap = &tx_tt_news[tt_news]=|
Remove tthe underscore:
20.wrap = &tx_ttnews[tt_news]=|
And do not set cHash by hand! 30.wrap = &cHash=| It will prevent your page from being cached, because the cHash will be wrong!