TYPO3 - Contents are displayed twice on translate - typo3

I'm using TYPO3 9.5 and I'm trying to translate page using the Copy process from TYPO3,
The Problem that the content are displayed twice when I change to other language beside the default language (EN).
languages:
-
title: English
enabled: true
languageId: '0'
base: /
typo3Language: default
locale: en_US.UTF-8
iso-639-1: en
navigationTitle: EN
hreflang: en-US
direction: ''
flag: en-us-gb
-
title: Deutsch
enabled: true
languageId: '1'
base: /de/
typo3Language: de
locale: de_DE.UTF-8
iso-639-1: de
navigationTitle: de
hreflang: de-DE
direction: ''
fallbackType: fallback
fallbacks: '0'
flag: de
In my config I have tried to use: languageField = sys_language_uid
select {
orderBy = sorting
languageField = sys_language_uid###
where = {#colPos}={register:colPos}
where.insertData = 1
pidInList.data = register:pageUid
pidInList.override.data = register:contentFromPid
}
But will always display the default language(EN) but if use :
includeRecordsWithoutDefaultTranslation = 1
The content will displayed twice in the Default language and the selected language .
Edit :
config {
absRefPrefix = auto
no_cache = {$config.no_cache}
uniqueLinkVars = 1
noPageTitle = 2
linkVars = L
prefixLocalAnchors = {$config.prefixLocalAnchors}
renderCharset = utf-8
metaCharset = utf-8
doctype = html5
removeDefaultJS = {$config.removeDefaultJS}
inlineStyle2TempFile = 0
admPanel = {$config.admPanel}
debug = 0
cache_period = 86400
sendCacheHeaders = {$config.sendCacheHeaders}
enableContentLengthHeader = 1
intTarget = 0
disablePrefixComment = 1
index_enable = 1
index_externals = 1
index_metatags = 1
headerComment = 0
contentObjectExceptionHandler = 0
compressJs = 0
compressCss = 0
concatenateJs = 0
concatenateCss = 0
}
The Problem was solved for the double content in the config yml :
fallbackType: strict

The options languageField and pidInList will be detected automatically to match the current page and language while respecting the table you are trieng to fetch. For testing purposes you may only use "< styles.content.get" to fetch the content of colPos=0 of the current page.
However I think your problem is located somewhere else in your configuration. Do you also setup some language settings of the config.-Typoscript-Section like sys_language_uid depending on the "L"-GET-Var?

Related

Typo3 vhs language returns id instead of language

I try to setup a language menu with 3 different languages. For english and german its working. It shows the current language either as EN or DE. But when i switch to italian, it only shows the id (7) in the frontend.
My Code is:
{v:page.language(languages: 'EN,DE,IT', pageUid: '0', normalWhenNoLanguage: 'EN')
Lanugage setup:
[globalVar = GP:L = 1]
config {
sys_language_uid = 1
language = de
locale_all = de_DE.UTF-8
htmlTag_setParams = lang="de" dir="ltr" class="no-js"
}
[global]
[globalVar = GP:L = 2]
config {
sys_language_uid = 2
language = fr
locale_all = fr_FR.UTF-8
htmlTag_setParams = lang="fr" dir="ltr" class="no-js"
}
[global]
[globalVar = GP:L = 7]
config {
sys_language_uid = 7
language = it
locale_all = it_IT.UTF-8
htmlTag_setParams = lang="it" dir="ltr" class="no-js"
}
[global]
If the id is 7 and your array of languages only contains three elements, what do you expect?
The VH does not access the TS configuration. It can't as the VH can not influence conditions to select the 'requested' language. So it only can access the current language configuration.
The 8th element of three elements (= your first parameter to this VH: the array with the 2 character language codes) would be out of range and should not be accessed (and if you do as it is possible in some languages you get an security issue).

Typo3 CMS 8.7.15 // restrict search results to current language

I'm using the TYPO3 version TYPO3 CMS 8.7.15. with a multilanguage setup. Everything works fine. German is the default language. The other configured languages are english, portugeese and chinese. The problem is when I try to search keywords in different languages than the current language, i get results from the other translations. I want to ask for the right settings to display only search results in the current language from the current content.
config {
linkVars = L
uniqueLinkVars = 1
sys_language_mode = content_fallback
sys_language_overlay = 1
sys_language_uid = 0
locale_all = de_DE.UTF-8
htmlTag_langKey = de
language = de
}
plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 0
# SPRACHE: ENGLISCH
[globalVar = GP:L=6]
config {
sys_language_uid = 6
language = en
locale_all = en_GB.UTF-8
htmlTag_setParams = en
}
pugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 6
[global]
# SPRACHE: PORTUGIESISCH
[globalVar = GP:L=7]
config {
sys_language_uid = 7
language = pt
locale_all = pt_PT.UTF-8
htmlTag_setParams = pt
}
plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 7
[global]
# SPRACHE: CHINESISCH (EINFACH)
[globalVar = GP:L=8]
config {
sys_language_uid = 8
language = zh
locale_all = zh_CN.UTF-8
htmlTag_setParams = zh
}
plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 8
[global]
The only way to configure it right is the plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang variable. But this has no effect to my search results. What is wrong with my configuration?
If you put your search field into your menu for example (fluidtemplate) the <f:form.hidden name="search[languageUid]"is not filled. So the results shows all languages.
I helped myself by using a lib that gives me the current language.
Fluid:
<f:form.hidden name="search[languageUid]" value="{f:cObject(typoscriptObjectPath: 'lib.language')}" />
Typoscript Setup:
# German language
temp.language = TEXT
temp.language.value = 0
# English language
[globalVar = GP:L = 1]
temp.language.value = 1
[global]
lib.language < temp.language

TYPO3 4.5 - Multilingual - How can I use the second Language as default?

how can I set my 'second' language at my TYPO3 Website (4.5.x) to default?
I have ID0 = german, ID1 = english and ID2 = spanish
At the moment, if there's no translation TYPO3 will show the default language (0=german)
Here's my TS
# multilingual
##################
config.linkVars = L
config.uniqueLinkVars = 1
# no translation go to default
config.sys_language_mode = content_fallback
# not translated elements, show default
config.sys_language_overlay = 1
#config.sys_language_overlay = hideNonTranslated
# German / default :
config.sys_language_uid = 0
config.language = de
config.locale_all = de_DE.UTF8
# English :
[globalVar = GP:L = 1]
config.sys_language_uid = 1
config.language = en
config.locale_all = en_EN.UTF8
config.htmlTag_langKey = en
[global]
# Spanish :
[globalVar = GP:L = 2]
config.sys_language_uid = 2
config.language = es
config.locale_all = es_ES.UTF8
config.htmlTag_langKey = es
[global]
the solution for your problem is the attribute sys_language_mode
You can define the fallback for each language.
For example in your case
[globalVar = GP:L2]
config {
sys_language_uid = 2
language = es
locale_all = es_ES.UTF-8
htmlTag_langKey = es
sys_language_mode = content_fallback;1,0
}
[global]
This setup the content_fallback followed by the ordering of language_uid that should be used for fallback.
For detailed documentation read the TSREF
http://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Config/Index.html#sys-language-mode
Cheers
Christian

Language Switcher TYPO3

I'm trying to create a language switch with personal images that makes possible to change the website language in the frontend (I already defined the languages and the alternative language pages). I'm using a snippet from TYPO3 Core Documentation, but it's not working for me, so I must be doing something wrong...I added a marker in my template called LANGUAGE, which corresponds to a DIV in the top right corner of the main container, where would appear some representative flags of the languages available for that page.
Here it is my TS code in the Template:
config.linkVars = L , type
config.sys_language_uid = 0
config.language = en
config.locale_all = en_EN
[globalVar = GP:L =0]
config.sys_language_uid = 0
config.language = en
config.locale_all = en_EN
config.htmlTag_langKey = en
[global]
[globalVar = GP:L =1]
config.sys_language_uid = 1
config.language = pt
config.locale_all = pt_PT
config.htmlTag_langKey = pt
[global]
[globalVar = GP:L =2]
config.sys_language_uid = 2
config.language = fr
config.locale_all = fr_FR
config.htmlTag_langKey = fr
[global]
[globalVar = GP:L =3]
config.sys_language_uid = 3
config.language = de
config.locale_all = de_DE
config.htmlTag_langKey = de
[global]
page.10.marks.LANGUAGE {
lib.langMenu = HMENU
lib.langMenu {
special = language
special.value = 0,1,2,3
special.normalWhenNoLanguage = 0
1 = GMENU
1.NO {
XY = [5.w]+4, [5.h]+4
backColor = white
5 = IMAGE
5.file = fileadmin/Template/images/english.png || fileadmin/Template/images/portuguese.png || fileadmin/Template/images/french.png || fileadmin/Template/images/german.png
5.offset = 2,2
}
}
}
Yes, this can't work because you're defining a lib element inside a mark. You must nest your code differently:
lib.langMenu = HMENU
lib.langMenu {
[all your stuff from the lang menu]
}
and then
page.10.marks.LANGUAGE < lib.langMenu
By the way, if you also define the states USERDEF1 and USERDEF2 and use doNotShowLink = 1, then the link to a language isn't rendered if the page is not available in this language. This can be very helpful when not all your content is translated and you don't want to use fallback:
USERDEF1 = 1
USERDEF1.doNotShowLink = 1
USERDEF2 < .USERDEF1

Setting sys_language_overlay = hideNonTranslated hides translated content elements on root page (inversed behaviour)

I've setup a multilanguage (german [default], english, japanese) TYPO3 project with Templavoila and want to hide non translated content elements. Therefore I defined sys_language_overlay = hideNonTranslated. Generally this does work well but has an unexpected side effect on the root/homepage. If the overlay mode it set to hideNonTranslated no content will show up on the homepage at all while non translated content is hidden on all subpages as expected.
Below is my typoscript showing the language setup.
config{
sys_language_overlay = hideNonTranslated
sys_language_mode = strict
linkVars = L
uniqueLinkVars = 1
tx_cooluri_enable = 1
redirectOldLinksToNew = 1
}
// ger
[globalVar = GP:L = 0]
config{
sys_language_uid = 0
language = de
locale_all = de_DE.UTF-8
htmlTag_langKey = de-DE.utf8
}
[global]
// en
[globalVar = GP:L = 1]
config{
sys_language_uid = 1
language = en
locale_all = en_US.UTF-8
htmlTag_langKey = en-US.utf8
}
[global]
// jp
[globalVar = GP:L = 2]
config{
sys_language_uid = 2
language = jp
locale_all = jp_JP.utf8
htmlTag_langKey = jp-JP.utf8
}
[global]
How could I track down what causes that issue. What do I have to change in order to get the expected behaviour?
I really can't tell what's wrong with my setup. So any input is highly appreciated.
So I found the "issue".
It was caused by a small difference in the page layout on the homepage in comparison to subpages. The homepage uses additional flexible content elements provided by Templavoila. These have to be configured to appear in all languages by setting the language field inside the fce to [All] instead of Default.