Bug #19114
closedsys_language_mode content_fallback with a defined fallback chain does not output expected fallback content
Added by Bernd Warken over 16 years ago. Updated over 5 years ago.
100%
Description
I installed German as default language and 3 further languages:
en L=1
tr L=2
ru L=3
Unfortunately I am not able to relink language ru (L=3) back to English (L=1). The program will always switch to the default language (German).
My configuration:
###
config {
# Default-Sprache
linkVars = L
uniqueLinkVars = 1
sys_language_uid = 0
language = de
locale_all = de_DE
htmlTag_langKey = de-DE
sys_language_mode = content_fallback
sys_language_overlay = 1
}
page.config.language = de
page.config.locale_all = de_DE.UTF-8
[globalVar = GP:L = 1]
config {
sys_language_uid = 1
sys_language_mode = content_fallback ; 0
language = en
locale_all = en_US
htmlTag_langKey = en-US
}
page.config.language = en
page.config.locale_all = en_EN
[global]
[globalVar = GP:L = 2]
config {
sys_language_uid = 2
sys_language_mode = content_fallback ; 0,1
language = tr
locale_all = tr_TR
htmlTag_langKey = tr-TR
}
page.config.language = tr
[global]
[globalVar = GP:L = 3]
config {
sys_language_uid = 3
sys_language_mode = "content_fallback ; 1,0"
language = ru
locale_all = ru_RU
htmlTag_langKey = ru-RU
}
page.config.language = ru
[global]
###
Bernd Warken
(issue imported from #M8986)
Files
bug_8986.diff (2.37 KB) bug_8986.diff | Administrator Admin, 2009-04-06 14:42 | ||
bug_8986_v2.diff (4.76 KB) bug_8986_v2.diff | Administrator Admin, 2009-04-23 16:00 | ||
patch_8986_v3.diff (4.78 KB) patch_8986_v3.diff | Administrator Admin, 2010-07-02 15:49 | ||
Bildschirmfoto 2018-11-08 um 18.42.41.png (75 KB) Bildschirmfoto 2018-11-08 um 18.42.41.png | Ralf Merz, 2018-11-08 19:15 |
Updated by Christian Kuhn over 15 years ago
Hi Bernd,
I read your issue description twice, but I just do not understand your problem. Is this still valid for you? Could you please explain in a bit more detail what you try to achieve? What do you mean with "relink language ru (L=3) back to English (L=1)"? Which link should be created and when? In a content element or in a language selector?
Updated by Bernd Warken over 15 years ago
This issue is still valid, even with TYPO3 4.1.10 and 4.2.6. The term "relink" refers to the fact that TYPO3 replaces untranslated parts by the corresponding part in another language. This is usually the default language (German for me), but for Russian it should print the English text.
As an example, see http://www.schulungsraum-muenchen.de. There, untranslated Turkish prints correctly the German text because of
config.sys_language_mode = content_fallback ; 1,0
But Russian had the TypoScript code
config.sys_language_mode = content_fallback ; 0,1
So it should print the text for L=1 (English for me), but it does not and prints the German text instead.
So config.sys_language_mode does not work according to the documentation.
Updated by Steffen Kamper over 15 years ago
sry, i don't see any russian or turkish translation there.
config.sys_language_mode = content_fallback ; 0,1
doesn't make sense, as it always fall back to 0 which is german in your case.
also using "" is wrong.
Updated by Bernd Warken over 15 years ago
Exactly, the Russian and Turkish should be redirected as untranslated, so there is no translation.
I now tried
config.sys_language_mode = content_fallback ; 1
without quotes for the Russian, so it should redirect to English; but it still redirects to the German default. No idea.
Updated by Michael Stucki over 15 years ago
The problem is that config.sys_language_mode only affects the page record. There is no content-fallback if the current page is translated, but not all records on it.
I have written a patch that implements this for TYPO3 4.2.6. Please try it out and let me know if that helps.
- michael
Updated by Michael Stucki over 15 years ago
Attached is a patch that fixes the problem at least partly:
Preconditions:
- config.sys_language_overlay is 1
- config.sys_language_mode = content_fallback; <uid-list>
In such a case, a page that is translated will always select the default language unless the record is localized. However, if the record is localized for a language which is different than the selected one but matches the content-fallback list, this would currently have no effect.
The patch solves this by walking through the content-fallback list.
Updated by Michael Stucki over 15 years ago
Added new patch which implements the same for t3lib_pageSelect::getPageOverlay(). This will affect menus etc.
Updated by Jens Schmietendorf over 15 years ago
I´ve tried out the first patch, it works great.
Updated by Johannes Schlatow over 15 years ago
I tried the second patch. It's just great.
Updated by Gregor Schreier over 14 years ago
i've implement the second patch in TYPO3 - 4.3.3, works !
- even if an alternative Pagetranslation exist with no Content on it
Why is this not in the Core ? This is an must have for mulitlanguage-sites.
I use this with patch from 6009 - ( T3X_danp_languagefallback_patch-0_0_0-z-200708151515.t3x )
Updated by Chris topher over 14 years ago
Hi guys,
the point is that nobody has sent this patch to Core List.
To get this fix in the next releases, one of you has to post it to the TYPO3-Core-list.
Check out http://typo3.org/teams/core/core-mailinglist-rules
Updated by Martin R. Krause almost 14 years ago
The 8986_v3 Patch has a drawback:
The option hide page if no translation exists is ignored, if the language in question does not fall back to the default language directly. In this (not so rare) case the page will be show, no matter if a translation exists an the tranlated page is set hidden or no translation has been set up (in which case content fallback will work).
So the patch has to be refined to respect the l18n_cfg field from the pages table.
Any ideas, how?
Updated by Dmitry Dulepov over 13 years ago
I do not think this will work correctly because tslib_fe calls the patched function with different language ids from the "content_fallback":
$fallBackOrder = t3lib_div::intExplode(',', $sys_language_content); foreach($fallBackOrder as $orderValue) { if (!strcmp($orderValue,'0') || count($this->sys_page->getPageOverlay($this->id, $orderValue))) { $this->sys_language_content = $orderValue; // Setting content uid (but leaving the sys_language_uid) break; } }
Instead of returning the result for that language, your patched version return the result for some other language. TSFE will assign a wrong language id (not the one you found but the one it supplied to the patched function).
What you should do to ensure that languages work:
- content_fallback is set correctly, no changes here
- set config.sys_language_mode to hideIfNotTranslated (or whatever it is, see in TSRef) or to 0 (what best suits your needs)
- [!!!] make sure that you do NOT have an "alternative language record" for the language where you do not have any content. An existing alternative page language makes the page translated and it shows you the translated page content, which is empty in your case. Content fallback happens only and only if you have no alt page language (=page is not translated). This is how it should work. Even TSRef says so: "The system will always operate with the selected language even if the page is not translated with a page overlay record. This will keep menus etc. translated. However, the content on the page can still fall back to another language, defined by the value of this keyword"
- [!!!] make sure that hidePagesIfNotTranslatedByDefault=0 in the install tool. If it is 1, you will get a 404 error when you remove the alt page language record.
So there is no bug there. And the patch is wrong, sorry.
Updated by Dmitry Dulepov over 13 years ago
I wrote all of the above because we just had the same issue and solved it only by a proper combination of settings. In our case the Install tool setting was causing problems.
Updated by Gerrit Code Review about 12 years ago
- Status changed from Accepted to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/14464
Updated by Gerrit Code Review about 12 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/14464
Updated by Gerrit Code Review about 12 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/14464
Updated by Gerrit Code Review about 12 years ago
Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/14464
Updated by Ingo Pfennigstorf about 12 years ago
The current patch has been testet with current master and "normal" content rendering, patchset 3 also with TYPO3 4.5 and TemplaVoila.
Updated by Markus Klein about 12 years ago
Please look at the more general solution in #17354.
Updated by Stefan Neufeind about 12 years ago
#17354 takes a much more generic approach. Please see my comment in that review (https://review.typo3.org/14464).
As such it tries to change more and would imho clearly be a [FEATURE] (as it is already mentioned in the review-request). Since feature-freeze for 6.0 is over it also can't even go into 6.0. And face the facts: We have broken content_fallback in the LTS-version (from 4.5 all through to 6.0).
So imho #17354 would be nice to have and is under discussion as a new "feature" (in what form it might be accepted). But this here for the moment is a bugfix (!).
Updated by Ingo Pfennigstorf about 12 years ago
#34670 (duplicate) shows some additional information
Updated by Gerrit Code Review about 12 years ago
Patch set 5 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/14464
Updated by Camelia M almost 12 years ago
I have this problem too using typo3 6.0 and templavoila 1.8.0. Is there a working patch for typo3 6.0?
Updated by Mike Gebhard almost 12 years ago
I´ve just patched my 6.0.2 installation and it works fine. I used the Patch-Set 5 which is currently under review.
Updated by Camelia M almost 12 years ago
Mike Gebhard wrote:
I´ve just patched my 6.0.2 installation and it works fine. I used the Patch-Set 5 which is currently under review.
for me works ok too
Updated by Gerrit Code Review over 11 years ago
Patch set 6 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/14464
Updated by Gerrit Code Review almost 10 years ago
Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/14464
Updated by Alexander Opitz about 9 years ago
- Description updated (diff)
- Target version changed from 0 to 7.5
- Is Regression set to No
Updated by Benni Mack about 9 years ago
- Target version changed from 7.5 to 7 LTS
Updated by Jo Hasenau about 6 years ago
- Subject changed from sys_language_mode does not work to sys_language_mode content_fallback with a defined fallback chain does not output expected fallback content
- Status changed from Under Review to Accepted
- Target version set to next-patchlevel
- TYPO3 Version changed from 4.1 to 7
- PHP Version changed from 5.2 to 5.6
Since the patch is abandoned in the review tracker, I set the ticket back to accepted and the TYPO3 version to the latest, that will still be supported after the release of CMS 9. The problem still exists so I will try to describe it again.
Current scenario within a CMS 8 client project:
3 languages: Default (0) EN, German Master (1) DE-DE, Austrian version (2) DE-ATNow the settings are as follows:
sys_language_uid = 0 sys_language_overlay = 1 sys_language_mode = content_fallback
For the German Master:
sys_language_uid = 1 sys_language_overlay = 1 sys_language_mode = content_fallback
For the Austrian Translation:
sys_language_uid = 2 sys_language_overlay = 1 sys_language_mode = content_fallback;1
Expected menu behaviour for the Austrian pages (&L=2) would be:
- If a page is translated to Austrian, it is visible in the menu with the Austria title
- If a page is not translated to Austrian but translated to German Master, it is visible in the menu with the German Master title
- If a page is not translated to Austrian and not translated to German Master, it is visible in the menu with the Default title
- If a page is not translated to Austrian and not translated to German Master and set to "hide default translation of page", it is not visible in the menu at all
This is working so far
For the broken part we need the expected behaviour first¶
Expected content behaviour for the Austrian pages would be:- If a page is translated to Austrian and content is translated to Austrian, Austrian content is visible
- If a page is translated to Austrian and content is not translated to Austrian at all but to German Master, German Master content is visible instead
- If a page is translated to Austrian and some content is not translated to Austrian but to German Master, Asutria and German Master content is visible
- If a page is not translated to Austrian but translated to German Master and content is translated to German Master, German Master content is visible instead
- If a page is translated to Austrian and content is translated to Austrian, Austrian content is visible
- If a page is translated to Austrian and content is not translated to Austrian at all but to German Master, Default content is visible instead
- If a page is translated to Austrian and some content is not translated to Austrian but to German Master, Austrian content and Default content is visible
- If a page is not translated to Austrian but translated to German Master and content is translated to German Master, Default content is visible instead
Result of the investigation is: As soon as there is a translation of the page record available, the content_fallback chain is completely ignored for tt_content records.
The reason for that behaviour lies in the TypoScriptFrontendController, which is not considering content_fallback settings due to the following if clause:
// Request the overlay record for the sys_language_uid: $olRec = $this->sys_page->getPageOverlay($this->id, $this->sys_language_uid); if (empty($olRec)) { // If no OL record exists and a foreign language is asked for... if ($this->sys_language_uid) { // If requested translation is not available: if (GeneralUtility::hideIfNotTranslated($this->page['l18n_cfg'])) { $this->pageNotFoundAndExit('Page is not available in the requested language.'); } else { switch ((string)$this->sys_language_mode) { case 'strict': $this->pageNotFoundAndExit('Page is not available in the requested language (strict).'); break; case 'content_fallback': // Setting content uid (but leaving the sys_language_uid) when a content_fallback // value was found. $fallBackOrder = GeneralUtility::trimExplode(',', $sys_language_content); foreach ($fallBackOrder as $orderValue) { if ($orderValue === '0' || $orderValue === '') { $this->sys_language_content = 0; break; } if (MathUtility::canBeInterpretedAsInteger($orderValue) && !empty($this->sys_page->getPageOverlay($this->id, (int)$orderValue))) { $this->sys_language_content = (int)$orderValue; break; } if ($orderValue === 'pageNotFound') { // The existing fallbacks have not been found, but instead of continuing // page rendering with default language, a "page not found" message should be shown // instead. $this->pageNotFoundAndExit('Page is not available in the requested language (fallbacks did not apply).'); } } break; case 'ignore': $this->sys_language_content = $this->sys_language_uid; break; default: // Default is that everything defaults to the default language... $this->sys_language_uid = ($this->sys_language_content = 0); } } } } else { // Setting sys_language if an overlay record was found (which it is only if a language is used) $this->page = $this->sys_page->getPageOverlay($this->page, $this->sys_language_uid); }
Removing the translation of the page record reactivates the content fallback chain and calling that page with ID and L=2 generates the expected fallback content output.
But the fallback output is completely missing as soon as the page record is translated but contains no content translations at all or just some content translations.
So the content_fallback is not a content_fallback at all but actually a page_fallback.
Updated by Jo Hasenau about 6 years ago
- Related to Bug #81657: TSFE->page contains default language page when content_fallback; 1,0 is used added
Updated by Ralf Merz about 6 years ago
Hi,
i just want to add my 2 cents to say I ran in the problem Jo explains here.
I have added a screenshot:
What I want is: I translate a page... (all fallbacks are defined in site configuration) but I add no content, as I want to use the content_fallback feature.
So as shown in the screen: I want "German (DE)" to output "German (CH)" content elements if there are no translations at all.
Maybe it would be even possible to fetch not-translated elements from CH to output on DE:
Could this be done?
Regards
merzilla
Updated by Ralf Merz about 6 years ago
Hi,
sorry, in my last post i forgot to add the TYPO3 version:
The content fallback does not work with v9 LTS using the site configurations, too.
Updated by Gerrit Code Review almost 6 years ago
- Status changed from Accepted to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59488
Updated by Ralf Merz almost 6 years ago
- Related to Bug #86762: Site-Configuration defined language fallbacks not working added
Updated by Gerrit Code Review almost 6 years ago
Patch set 13 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59676
Updated by Gerrit Code Review almost 6 years ago
Patch set 14 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59676
Updated by Gerrit Code Review almost 6 years ago
Patch set 15 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59676
Updated by Gerrit Code Review almost 6 years ago
Patch set 16 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59676
Updated by Gerrit Code Review almost 6 years ago
Patch set 17 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59676
Updated by Gerrit Code Review almost 6 years ago
Patch set 18 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59676
Updated by Gerrit Code Review almost 6 years ago
Patch set 19 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59676
Updated by Gerrit Code Review almost 6 years ago
Patch set 20 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59676
Updated by Gerrit Code Review almost 6 years ago
Patch set 21 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59676
Updated by Gerrit Code Review almost 6 years ago
Patch set 22 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59676
Updated by David Bruchmann almost 6 years ago
After applying the patch I get this error shown:
Argument 2 passed to TYPO3\CMS\Core\Routing\PageRouter::getPagesFromDatabaseForCandidates() must be of the type integer, string given
But even after removing the int for the parameter $languageId and adding this as first line of the function:
$languageId = intval($languageId);
I never get the desired fallback behavior, but only a blank content-area (navigation was partially translated before applying the patch, though there is a fallback to German instead of French).
Currently I use this configuration, the Italian page is throwing the error:
rootPageId: 1 base: 'https://german.domain.com' baseVariants: { } languages: - title: Deutsch enabled: true languageId: '0' base: / typo3Language: de locale: de_CH.UTF-8 iso-639-1: de navigationTitle: Deutsch hreflang: de-CH direction: ltr flag: de - title: Français enabled: true languageId: '1' base: 'https://french.domain.com/' typo3Language: fr locale: fr_FR.UTF-8 iso-639-1: fr navigationTitle: Français hreflang: fr-FR direction: ltr fallbackType: strict flag: fr - title: Italiano enabled: true languageId: '2' base: 'https://italian.domain.com/' typo3Language: it locale: it_IT.UTF-8 iso-639-1: it navigationTitle: Italiano hreflang: it-IT direction: ltr fallbackType: fallback fallbacks: '1' flag: it errorHandling: - errorCode: '404' errorHandler: Page errorContentSource: 't3://page?uid=3' routes: - route: robots.txt type: staticText content: "User-agent: *\r\n\r\ndisallow: /typo3/\r\ndisallow: /typo3_src/\r\ndisallow: /typo3conf/\r\nallow: /typo3conf/ext/templates/*/generated/\r\nallow: /typo3conf/ext/templates/*/min/\r\nallow: /typo3conf/ext/templates/*/js/\r\nallow: /typo3conf/ext/templates/*/css/\r\nallow: /typo3conf/ext/templates/*/images/\r\nallow: /typo3conf/ext/templates/*/fonts/\r\nallow: /typo3conf/ext/*/Resources/Public/"
Actually I need the same behavior that's described in https://forge.typo3.org/issues/19114?issue_count=99&issue_position=2&next_issue_id=86595&prev_issue_id=87093#note-38
Updated by Gerrit Code Review over 5 years ago
Patch set 23 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59676
Updated by Gerrit Code Review over 5 years ago
Patch set 24 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59676
Updated by Gerrit Code Review over 5 years ago
Patch set 25 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59676
Updated by Gerrit Code Review over 5 years ago
Patch set 26 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59676
Updated by Gerrit Code Review over 5 years ago
Patch set 27 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59676
Updated by Gerrit Code Review over 5 years ago
Patch set 28 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59676
Updated by Gerrit Code Review over 5 years ago
Patch set 29 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59676
Updated by Gerrit Code Review over 5 years ago
Patch set 30 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59676
Updated by Gerrit Code Review over 5 years ago
Patch set 31 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59676
Updated by Gerrit Code Review over 5 years ago
Patch set 32 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59676
Updated by Gerrit Code Review over 5 years ago
Patch set 33 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59676
Updated by Gerrit Code Review over 5 years ago
Patch set 34 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59676
Updated by Gerrit Code Review over 5 years ago
Patch set 35 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59676
Updated by Gerrit Code Review over 5 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/59845
Updated by Andreas Fernandez over 5 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 8d61bef0865649bbe3d73bdf77a47c760c8d9ba4.
Updated by Mathias Brodala almost 5 years ago
- Related to Bug #89871: HrefLangGenerator: Wrong links generated with page translations that use a shortcut added