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
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?
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
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 working on a website that is made in typo3. I'm doing a part of the website that is made by somebody else, so I don't know that much of typo3.
This website uses realurl to translate the url to a readable one. How can I make a realurl? When I make like for example the index page there is no realurl made for this page. How could I generate one?
First of all, check the manual of realurl :
http://typo3.org/extensions/repository/view/realurl/current/
http://typo3.org/documentation/document-library/extension-manuals/realurl/1.10.2/view/
Check if RealUrl is enabled via TypoScript.
Check if links are generated with TYPO3 API / TypoScript.
Use RealUrl configurators
http://typo3.org/extensions/repository/view/cbrealurl/current/
Dmitry got more relevant tutorials about RealURL:
http://www.dmitry-dulepov.com/2008/05/realurl-made-easy-part-1.html
http://www.dmitry-dulepov.com/2008/06/realurl-made-easy-part-2.html
RealURL will be very easy to understand when you'll make it work with default configuration and understand the meaning of parts: 'init', 'preVars', 'postVarSets', 'pagePath', 'fixedPostVars' and 'fileName'.
Copy my configuration
typoscript in setup:
config.simulateStaticDocuments = 0
config.baseURL = /
config.tx_realurl_enable = 1
config.uniqueLinkVars = 1
config.absRefPrefix = http://www.ceisufro.cl/
page.config.language = cl
config.sys_language_uid= 0
config.useSysLanguageTitle = 1
config.language= es
config.language_alt= es
config.htmlTag_langKey= es
config.linkVars = L
config.sys_language_overlay = 1
config.htmlTag_setParams = xmlns="http://www.w3.org/1999/xhtml"
xml:lang="es" lang="es"*
In file localconf.php
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
'www.ceisufro.cl'=> array(
'init' => array (
'enableCHashCache' => '1',
'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => '1',
'enableUrlEncodeCache' => '1',
),
'redirects' => array (
),
'preVars' => array(
'0' => array(
'GETvar' => 'L',
'valueMap' => array(
'es' => '1',
'en' => '0',
'it' => '4',
),
'noMatch' => 'bypass',
'valueDefault' => 'es',
),
),
'fileName' => array(
'defaultToHTMLsuffixOnPrev' => '1',
),
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => '3',
'rootpage_id' => '1',
), 'fileName' => array (
'index' => array (
'rss.xml' => array (
'keyValues' => array (
'type' => '100',
'id' => '37'
),
),
'contacto.xml' => array (
'keyValues' => array (
'id' => '666',
'no_cache'=>'1'
),
),
)),
'fixedPostVars' => array(
),
),
);
go to ext manager, find the ext realurl and add the following configurations
check Enable automatic configuration
select Serializable in Automatic configuration file format
check Enable devLog
I wait to can help somebody