Problem/Motivation
I translated field labels through the configuration translation module UI. When I create a node and then translate it the translated version reflects translated field labels so for example fr/node/nid has all labels translated. However if I clear the cache while still being on translated page (any path with language prefix) all labels become English (default language) again. If I switch to default language and then clear cache one more time then switch to French labels are translated again.
Basically every time the cache is cleared through UI while on the page with language prefix fr/... it resets translation for previously translated configuration items. And when the cache is cleared on default language the translation is back to normal.
On the site all multilingual core modules are enabled. Translation is enabled for content types and for fields. Default language of the site is English. Nodes were created in English with French translation.
Steps to reproduce
- Install all modules in Multilingual (language, locale, config_translation, content_translation)
- Added French language (any language should do) via /admin/config/regional/language
- Enable translation for Article under Content->Article at admin/config/regional/content-language
- Create a test Article node with some Tags content via /node/add/article
- View /fr/node/1 (or whatever), the Tags label should show as Étiquettes
- Navigate to /fr/admin/config/development/performance and clear cache via the UI
- Back to /fr/node/1 and the Étiquettes label is now "Tags"
Proposed resolution
After further investigation revealed that the translations getting cached while clearing cache in a state language override isn't in place. Which causes the system to save english/default translation into language prefixed cache key. This is caused by triggering entity title call in views route subscriber. Moving title of the route to title callback fixes the problem.
Remaining tasks
Manual testing and review.
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Comment | File | Size | Author |
---|---|---|---|
#146 | interdiff-2650434.txt | 571 bytes | catch |
#137 | interdiff-2650434-135-137.txt | 1.29 KB | duozersk |
#137 | interdiff-2650434-128-137.txt | 3.01 KB | duozersk |
#137 | clearing_cache_via_ui-2650434-137.patch | 10.83 KB | duozersk |
Comments
Comment #2
star-szrI was able to reproduce this as well with a clean D8 install.
b422873
And to "fix" it you can clear the cache via /admin/config/development/performance to restore the French label.
Comment #3
star-szrComment #4
nils.destoop CreditAttribution: nils.destoop as a volunteer and at Wunder commentedI can confirm this issue. It's also happening on the entity forms.
Comment #5
swentel CreditAttribution: swentel commentedBeen willing to confirm this as well for a couple of weeks now, but never got to it until today. Raising to major since it's extremely annoying - and also sometimes hard to reproduce consistently.
Comment #6
swentel CreditAttribution: swentel commentedWe're probably missing a tag and/or context somewhere.
Comment #7
penyaskitoJust guessing: maybe 'route.name' in \Drupal\Core\EventSubscriber\CacheRouterRebuildSubscriber::onRouterFinished?
Comment #8
vijaycs85just to update the progress on the investigation:
\Drupal::service('router.builder')->rebuild();
in drupal_flush_all_caches prevent the issueRouteBuilder::rebuild
dispatches RoutingEvents::DYNAMIC, RoutingEvents::ALTER and RoutingEvents::FINISHED events which might be causing issueComment #9
vijaycs85#7:
We have just
['4xx-response', 'route_match']
in there (8.0.x). Are you saying we should add route.name?Comment #10
vijaycs85Here is the test-only patch that fails.
Comment #12
vijaycs85After further investigation, found that the issue is caused by \Drupal\views\EventSubscriber\RouteSubscriber::routes and \Drupal\views\EventSubscriber\RouteSubscriber::onAlterRoutes.
When we clear cache at [langcode]/admin/config/development/performance,
Comment #13
vijaycs85Patches to prove #12. Just split the changes in #10 as separate test case (as we might need to add more tests for config translation + cache scenarios).
Comment #14
vijaycs85Comment #16
tstoecklerRe #12: Wow, that's majorly messed up. *Incredible* detective work @vijaycs85, very impressive!
Do you know where
\Drupal\Core\Config\Entity\ConfigEntityStorage->overrideFree()
gets set to TRUE?Comment #17
vijaycs85@tstoeckler: thank you :).
So it's basically happening at \Drupal\Core\Config\Entity\ConfigEntityStorage->loadMultipleOverrideFree. However how we are getting there in working vs not-working case is very different.
Attaching screenshot where overrideFree is TRUE/FALSE. Thought they are not exactly when the problem happens, just give idea of stack trace.
Comment #18
vijaycs85Looks like somewhere we lost the functionality provided by Drupal\language\EventSubscriber\LanguageRequestSubscribe which was trying to setConfigOverrideLanguage, but has no effect. Attached patch fix the issue. Not sure, if we still need the LanguageRequestSubscribe.
Comment #20
Gábor HojtsyShould the language negotiation process not end up in this language or some other language to set? I don't see why we need this explicitly, can you elaborate?
Comment #21
vijaycs85Sorry for the confusion @Gábor Hojtsy. That was me trying to fix the issue in a wrong way. Let's ignore #18.
The explanation in #12 stands valid still: When we clear cache with language prefix, the language manager get called even before the language context loaded to get the translation. So we are getting default (en) translation and saving it with current language prefix which is cached until you clear the cache from default/other language UI (or drush of course).
we have to use the tests in #13 as proof to find a solution.
Comment #23
Anonymous (not verified) CreditAttribution: Anonymous commentedSorry if I should not write in the issue. But I also have a problem with Add / Edit Form of translations. But there are no problems with Delete Form. Cleaning cache from ConfigTranslationDeleteForm it is works for me.
Comment #24
vijaycs85Thanks for reporting back the issue @vaplas, but the fix in your patch might not something we want to do. we want to find the root cause so that it fixes all scenarios.
Comment #25
Sharique CreditAttribution: Sharique as a volunteer commentedI spend some time today on this issue, but I'm not able to reproduce it, here is what I did
code is latest git code , not patch applied.
Comment #26
grahl@Sharique: I haven't retested this with a latest dev but I have a hunch that this might be also triggered when the default language and the field base language differ, i.e.: create some configuration English, then switch site default to German and amend configuration from there with some fields having German as the base and some English.
Comment #27
vijaycs85Updating issue summary with steps to reproduce from #1.
Comment #28
vijaycs85Comment #29
ErnoVanhala CreditAttribution: ErnoVanhala commented#26 I can confirm that this NASTY problem still exists.
Comment #31
vijaycs85Reverting back to 'Needs work'
Comment #32
vijaycs85As suggested by @timplunkett changing to title to callback. Though it doesn't solve any other similar issue from contrib module (because we don't define what can be done in Route/RouteAlter), fixes the issue summary locally.
Comment #34
tim.plunkettThis won't work, as it's trying to instantiate this plugin as a controller. Additionally, $this->view won't be set.
It likely needs to be a method on ViewPageController. But you'll have to figure out how to get from $view_id/$display_id to a ViewExecutable
A side-note, you can use
static::class
instead ofget_class($this)
Comment #35
vijaycs85Thanks @tim.plunkett. I have updated the code base. We are getting more fails with this patch. Just adding here with progress, if anyone wants to pick it up.
Comment #36
vijaycs85Another try with updated container and added test for getTitle() method.
Comment #37
grahlI just tried #36 and am still seeing the issue on cache clear.
Comment #38
vijaycs85@grahl, are you sure you are following the "steps to reproduce" in issue summary? If not (e.g like steps you mentioend in #26) we need new issue with steps to reproduce.
P.S There are few scenarios(like behind proxy), we don't get the translation file from localize.drupal.org when install module. So make sure the "tags" is translated on step 5 before proceed testing further.
Comment #39
Gábor HojtsyThe patch only deals with views titles, while the summary and examples in comments indicate a much more widespread problem. How did we end up fixing views only?
Comment #40
vijaycs85@Gábor Hojtsy, As per my analysis between #8 and #12, concluded that the root cause of the configuration cache is views title firing the discovery on routeAlter stage and the tests in #36 proves this theory :)
Comment #41
Gábor HojtsyOh, THAT would be important to note in the summary then in a proposed resolution. :)
Comment #42
vijaycs85Updated :)
Comment #43
vijaycs85Comment #44
vijaycs85Comment #45
badrange CreditAttribution: badrange commentedI haven't studied the patches above, I just wanted to note that I started subscribing to this issue after we had trouble with menu items getting the wrong translation - and this problem stopped occuring when we stopped clearing caches through the UI. It may be fixed by this patch, it may be a different issue, who knows.
Comment #46
vijaycs85Sounds related. Worth a try to test with patch or update steps to reproduce with this problem.
Comment #47
iampumaCurrently having the same problem with an English-Icelandic website (Drupal 8.1.8).
Default language is set to English, and labels are translated to Icelandic. Clearing caches resets all labels to English for some reason.
EDIT: I could conclude that flushing caches in a language other than the source language will mess up the translation of field labels. Clearing caches with drush however works ONLY if the setting "Selected language" in language detection is set to the "source language" as well.
Comment #48
Gábor Hojtsy@iampuma: does this patch help though?
Comment #49
badrange CreditAttribution: badrange commentedI just did a quick test of this using drush quick-drupal, PHP 5.6.25. I could not reproduce the issue with menu items. The problem with tags showing up in English after clearing caches from a non-english admin UI did occur, though, and the patch fixed it. Great!
The menu problem may have been fixed since we saw it (around Drupal 8.0.3 or so, if I remember correctly), or it may still be a problem that requires other steps to be reproduced.
Comment #50
vijaycs85Thanks for testing it @badrange
Thanks for confirming.
In any case we can't reproduce the issue for now.
Comment #51
Gábor HojtsyAll right @grahl, are you sure you are talking about the same problem?
Comment #52
Gábor HojtsyGiven no response from @grahl and the severity of this bug, let's get this in, since it does fix some of these problems at least if not all of them and in a nice way and with tests :) So let's get it in!
Comment #53
grahlSorry, I'll retest and otherwise a separate ticket, when I get the time. Thanks for your work!
Comment #54
catchMinor but we're down to 8 calls to entity_load() in core, this should use FilterFormat::load()
Does the comment need to describe the bug report/previous behaviour? Should either remove it or explain that we don't want to call getTitle() while building routes since that in turn loads config overrides or similar. At the moment this isn't very helpful.
Comment #55
vijaycs85Thanks @catch.
#54.1 - Updated.
#54.2 - Not sure if it the updated text makes sense now. Moved it to route so that it's much clear?
Comment #56
vijaycs85Comment #57
anemes CreditAttribution: anemes at PitechPlus commentedHello,
I spent a couple of hours on this issue and my conclusion is that when we clear the cache from UI there is a container rebuild which recreates all the services from the container. This is ok, but the LanguageManager is not initialized with the ConfgOverrideLanguage for the current language.
At the begining of the current request the LanguageManager was initialized with the current language because of the class LanguageRequestSubscriber is subscribed to the event KernelEvents::REQUEST which is called from the HttpKernel.
Since after the container rebuild there is no event dispatched LanguageManager stays with the default language and there is no and the config cache is saved with no override.
I will work on a patch today for this thing. Let me know if it makes sense what I wrote here.
Comment #58
anemes CreditAttribution: anemes at PitechPlus commentedComment #60
anemes CreditAttribution: anemes at PitechPlus commentedComment #61
anemes CreditAttribution: anemes at PitechPlus commentedComment #63
anemes CreditAttribution: anemes at PitechPlus commentedComment #65
anemes CreditAttribution: anemes at PitechPlus commentedComment #67
anemes CreditAttribution: anemes at PitechPlus commentedComment #68
Gábor Hojtsy@anemes: how does that relate to the work from @vijaycs85? Is the patch from @vijaycs85 just fixing one root cause and fixing it by chance because others don't use the language overrides system yet in the codepath? Or are the two problems separate? Your comments do not seem to explain this and you kind of took this issue over so it would be nice to clear this up.
Comment #69
anemes CreditAttribution: anemes at PitechPlus commentedI believe the fix I made is for the steps in the section "Steps to reproduce" and this was fixing it.
So in my opinion the problem is in the fact that when all the services get rebuild they are not recreated as they were at the beginning of the request by dispatching events like KernelEvents::REQUEST (in our case). This leaves some of the services stripped down of some functionalities which in our case are needed (the LanguageManager needs to have the current language set in order to work properly and it was only added once when the KernelEvents::REQUEST event is dispatched).
There might be also other issues generated by the fact that we expect the services to be initialized completely after the container is rebuilt. I only ran over this one yet.
I hope I answered your question.
Comment #70
bboty CreditAttribution: bboty commentedI reproduced the translation issue from the section "steps to reproduce" and after applying the patch made by @anemes it was fixed, according to my tests.
I ran into a practical problem that could've become serious if one used url language detection with "domain" name settings selected. (see at 'admin/config/regional/language/detection/url').
Since there are separate domains for each language, if an admin is logged in on domain of a translated version's interface and goes to clear caches, the current language (that was not the default one) translations used to get broken.
Comment #71
vijaycs85Thanks @anemes. I was looking for this sort of solution, but wasn't able to get the point where you dispatch new event. I just added the test case from my patch.
P.S: We might need change change record and adding an event is an API addition I believe.Comment #72
anemes CreditAttribution: anemes at PitechPlus commented@vijaycs85: did you run your tests with the patch and passed?
I didn't make any tests yet because I was waiting for the approval for the solution.
I didn't understand what you wanted to say with the last part of your comment (The P.S.).
Comment #73
vijaycs85Yes patch in #71 has tests. Ignore the P.S part. Looks like We do not consider event as API change.
Comment #74
Gábor HojtsyWhy do we need to set this to NULL here? How does this change what is already there?
Comment #75
anemes CreditAttribution: anemes at PitechPlus commentedThe call might not pass the part with if (($request_stack = $this->container->get('request_stack', ContainerInterface::NULL_ON_INVALID_REFERENCE))) in which case the chec if ($request) would generate a Notice with undefined variable.
Comment #76
alexpottWhy only if there is a request?
"Thde"? And longer than 80 chars
Longer than 80 chars
Let's not mix array styles.
Comment #77
vasi CreditAttribution: vasi at Evolving Web commentedThanks so much for your work on this, vijaycs85.
For anybody who needs a quick-and-dirty workaround, this is working for me so far:
Comment #78
anemes CreditAttribution: anemes at PitechPlus commentedI added the changes requested by alexpott.
Comment #79
anemes CreditAttribution: anemes at PitechPlus commentedComment #81
dan2k3k4 CreditAttribution: dan2k3k4 at Amazee Labs commented@anemes your last patch is empty file ?
Comment #82
chipway CreditAttribution: chipway at Chipway commentedNew patch including comments from #74.
Comment #84
anemes CreditAttribution: anemes at PitechPlus commentedSorry about the patch, I didn't upload the right file. The interdiff was correct, missed the patch file.
Comment #85
vijaycs85Thanks for the update @anemes. I think we still need to answer @alexpott's questions #76.1 and #76.2. I tried my level best to answer them, but feel free to correct me if I'm wrong.
#76.1: Main reason is the order of events and availability of language component. We are getting far later than we needed.
#76.2: We want to trigger the new event only for valid requests.
Comment #86
KevinVb CreditAttribution: KevinVb commentedSubscribe.
I had this issue as well. The patch solves this.
Comment #87
Arnoldski CreditAttribution: Arnoldski commentedAlso had the same issue. Patch #84 fixed it.
Comment #88
andypostComment is totally wrong
no reason to call that cos setCurrentUser() doing reset
this was not called in request subscriber
Comment #89
andypostA bit of clean-up
1) when you fire event it should not happen conditionally
2) clean up of request better to separate to another issue #2839396: Clean-up unused variable and useless method call from LanguageRequestSubscriber
3) initialization of language manager here with default language looks wrong
This way fixes the bug but I sure firing the event is not proper way to solve that
Suppose there should be some event when container rebuild on cache clear
Comment #91
andypostreverting a setting language for string translation
Comment #94
andypostComment #95
robert-os CreditAttribution: robert-os commentedComment #96
hkirsman CreditAttribution: hkirsman commentedThis fixes also bug in 8.2.5 but some of the code is already there so the patch fails. Only file that needs patching is core/modules/language/src/EventSubscriber/LanguageRequestSubscriber.php
If I would need patch against current version, where should I post this so my composer could download it? Older versions seems to be working for 2.x too. Will test. Are they ok to use?
Comment #97
hkirsman CreditAttribution: hkirsman commentedHm, 2650434-89.patch works for me. After clearing cache the correct translation for field label is used. Do you think it's safe to use?
Comment #99
Gábor HojtsySending to testbot.
Comment #100
John Cook CreditAttribution: John Cook commentedI've tested against 8.4.x branch and the patch works as planned.
I followed the reproduction instructions in the description and Cottser #2.
Before the patch
When clearing the cache through the localized performance page the labels are reset to English (default language) .
Cottser's work around of clearing the cache with the non-localized performance page works.
After applying the patch from #95
Clearing the cache through the localized performance page the labels remain in the localized language.
Setting to RTBC.
Comment #101
Gábor Hojtsy@tikaszvince also experienced this bug on a site. I sent him this issue on the Sprint Weekend. He tried and confirmed it worked for him. I am not sure if he did any code review.
Comment #102
TwoDI can verify #95 works for us as well.
We've had major issues with this when clearing caches on non-English pages or from Drush, but with this patch in place we have no problems with either.
I have not had time to look at the tests, but at least found a minor code-style issue with an extra space here:
Comment #103
TwoDA few comment changes only.
Comment #105
chipway CreditAttribution: chipway at Chipway commentedThanks TwoD,
I suggest renaming your interdiff as interdiff-2650434-95-103.txt to avoid tests run on it.
Comment #106
TwoDYeah, I was just about to apologize for that but got an error when submitting because of your post hehe.
Btw, Is there any chance this could get in sooner than 8.4?
Seems there's only API additions and it fixes a fairly annoying and confusing problem.
Comment #107
tstoecklerComment updates look fine, so re-RTBCing.
Also re-uploading the patch so that it will get continuously re-tested. (And not your interdiff ;-))
Comment #109
andypostComment #110
catchThe fix makes sense to me, but two things:
This needs an explanatory comment.
Could also do with some of the information in #69 added to the issue summary.
Comment #111
Jeroen_005 CreditAttribution: Jeroen_005 at Pàu for District09 commentedPatch #107 works fine for me, but after importing new po files (admin/config/regional/translate/settings) those config translations get lost again.
Even when "Don't overwrite existing translations." is selected.
Does anyone can reproduce this issue?
Comment #112
pguillard CreditAttribution: pguillard commentedIf anybody has a suggestion to the explanatory comment asked by @catch, I would be pleased to add a patch there, cause we need that patch into core !
@Jeroen_005 : I guess the trouble here is not correlated to .po files, as interface translations is configuration, not translation strictly speaking.
Comment #113
dawehnerHere is a patch against the 8.2.x branch
Comment #114
pguillard CreditAttribution: pguillard commented@Daniel : There is some strange docroot stuff in your patch ?
diff --git a/docroot/core/lib/Drupal/Core/DrupalKernel.php b/docroot/core/lib/Drupal/Core/DrupalKernel.php
I just removed that in this new one.
Will test that soon.
Comment #115
pguillard CreditAttribution: pguillard commentedI confirm the problem is solved.
=> Whatever the current language I'm on, a clear cache no longer affects the translation of my forms and labels.
I can't set that to RTBC by myself, at least to "Needs review".
Comment #118
yogeshmpawarRerolled the patch against 8.4.x branch because existing patch failed to apply on 8.4.x branch.
Comment #120
andypostand this still needs comment about why request could be empty
Comment #121
vijaycs85@andypost, trying to test without $request check - #1970534-111: Patch testing issue without polluting this issue.
Comment #122
davidraijmakers CreditAttribution: davidraijmakers commentedI rewrote the patch for 8.3.0-rc2
Comment #123
esolitosBeing such a serious and major bug, shouldn't this go directly in 8.3.x anyway?
Comment #124
dawehnerPlease fix the coding styler in this file (using phpcbf would help you a lot here). Problems are for example: 4/8 spaces instead of 2
Comment #125
eiriksmWorking on this
Comment #126
eiriksmFixed up the coding standards.
Also added a comment about the request variable, although I am not really sure why we check for it.
Comment #128
eiriksmComment #129
eelkeblokIt looks like this is based on #75. However, that seems to be about a different part of the code. The if ($request) was introduced in #67 by @anemes and seems to be a direct response to the test failures in #65, which are erroring out with:
If you go through the stack trace, the origin is indeed that call wrapped in the if. Now to explain that in a concise way in a comment...
Comment #130
Utilvideo CreditAttribution: Utilvideo commentedPatch worked for me, thanks
Comment #131
danielnolde CreditAttribution: danielnolde commentedPatch #128 fixes the problem for me on 8.3.1 – boy, i'm glad t have stumbled over this discussion just in time, made it barely to #8 by myself.
Comment #132
dan2k3k4 CreditAttribution: dan2k3k4 at Amazee Labs commentedAdding DrupalCon Baltimore 2017 tag: Baltimore2017
Comment #133
cbccharlie CreditAttribution: cbccharlie at Balidea commentedPatch #128 fixes the problem for me on 8.3.2.
Comment #134
mpp CreditAttribution: mpp as a volunteer and at AmeXio commentedPatch #128 fixes the problem for me on 8.3.2.
Comment #135
duozerskIt looks like the event @anemes suggested as a way to fix the issue should only fire when the container is rebuilt in a subrequest.
So I renamed the event from CONTAINER_INITIALIZE_FINISHED to CONTAINER_INITIALIZE_SUBREQUEST_FINISHED and moved its dispatching into the code block where the new session is being injected into the master request (exactly checking for the condition that we are in a subrequest).
Also corrected the array syntax to use the short syntax.
Comment #137
duozerskMoved event dispatching to the previous place.
Comment #138
andypostLooks good to me
imo
!empty($is_subrequest)
better but that's namingComment #139
r4arnys CreditAttribution: r4arnys commentedSo will this be fixed in 8.4 (because I still have this very annoying problem in 8.3.5)?
I'm a bit surprised that this is still an issue over a year later as it seems such a severe fundamental issue. I really don't want to get involved in patches if I don't have to.
Comment #140
vijaycs85Looks good to me. +1 to RTBC.
Comment #141
Utilvideo CreditAttribution: Utilvideo commented+1 testes
Comment #143
andypostbot flux
Comment #145
vijaycs85Sent the patch in #137 to test against 8.5.x just in case.
Comment #146
catchFixed the empty() on commit, see interdiff.
Committed/pushed to 8.5.x and cherry-picked to 8.4.x. Thanks!
I think we already have an issue to review subrequest usage, I don't really think they live up to expectations and we should look at dropping the concept if we can.
Comment #149
esolitosSo many Kudos to getting this finally in!
Comment #150
Wim LeersThis is a pretty significant new API.
Shouldn't this get a change record?
Or is this meant to be an
@internal
event?"language to the services" ?
Why this service priority?
Reopened for point 1, the other points probably need a follow-up.
Comment #151
prestonso CreditAttribution: prestonso commentedTagging for inclusion in 8.4.0-beta1 release notes.
Comment #152
vijaycs85Hi @Wim Leers:
Yeah it is, I just added a change record (https://www.drupal.org/node/2902228). I don't think it's internal as the issue could cause to any service (in core, it's just language override)
for #150.2 and 3, created a follow up at #2902230: Cleanup code and comment around CONTAINER_INITIALIZE_SUBREQUEST_FINISHED event
Comment #153
andypostCR filed & published, also follow-up created
Comment #155
Gábor HojtsyYy thanks all, this was not a small feat!
Comment #156
Priya Sundharam CreditAttribution: Priya Sundharam as a volunteer commentedHi Team,
Still I'm facing this issue in drupal 8.7.1 version. Has the fix moved to updated versions?
Any help will be grateful!
Comment #157
mpp CreditAttribution: mpp as a volunteer and at AmeXio commentedThere seems to be a regression, we're again facing this issue (now on Drupal 8.8.2).
Comment #158
arnested CreditAttribution: arnested at Reload commentedWe're also seeing something like this (8.7.8 currently).
We've seen it for some time but been unable to reproduce it enough to debug it.
Comment #159
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedThis issue is still happening on our project when clearing the cache in the English UI then all labels in the Dutch UI appear in English (on Drupal 8.8.2).
Our default language is English (we don't want to export Dutch config) and we have a language negotiator with a fallback to Dutch (/nl, /fr, /en, /de).
The first time we run this Behat test all is green, the second time it's failing because "Title" appears (instead of "Titel"):
Strangely, the following test is always green:
Also, when I use another role or a specific test user or change a permission the test succeeds (only the first time). Something is caching wrong config translations.
The error only seems to apply only for basefield overrides. EntityFieldManager::getFieldDefinitions() somehow contains their translations in the wrong language.
I think this issue is related because the patch in this issue is making changes to the behavior of the language negotiator and we can workaround the issue with
drush -y config-set language.negotiation url.prefixes.nl ''
Comment #160
mariusdiacu CreditAttribution: mariusdiacu commentedI confirm the same happens for 8.8.5, with interface text language detection active for "Account administration pages" and fallback to 'DE'. If I clear caches from UI, it mixes the config translations. If I do it from drush, it's fine (because drush runs with 'de').
Comment #161
mariusdiacu CreditAttribution: mariusdiacu commentedI'm not sure it's the same issue.. for me it happens also on a fresh install, without content translations active. The only condition is to have fallback language to something else than the site default language (which is en).
See my comment here on how I managed to reproduce it: https://www.drupal.org/project/drupal/issues/2189267#comment-13613125
I have no idea how to debug this, because checking if the label changed it will cache the result between debugger's steps.
Comment #162
nielsaers CreditAttribution: nielsaers commentedAlso seeing this on 8.9.13. How do we go forward with this? (as this is ticket is already closed and fixed)
Comment #163
nielsaers CreditAttribution: nielsaers commentedComment #164
Haessler CreditAttribution: Haessler as a volunteer and commentedDrupal 9 fresh install, clearing cache in /admin/config resets language. Still an issue …
Comment #165
TwoDI believe this is caused by having a single field definition cache, see #3114824: Add multilingual support for caching basefield definitions.
Elaborated a bit in #2189267-125: When content language detection is different from interface language detection, the detected language is not applied to the rendered content.
Comment #166
vvidovic CreditAttribution: vvidovic commentedThe problem still exists in version 9.3.9.
The workaround mentioned in comment #77 works fine for me in the new Drupal version.
Comment #167
Liam MorlandWe are having this problem as well on Drupal 9.5. The work-around in #77 is working for us.
Comment #168
Liam MorlandWe have had the problem return, despite the work-around in #77. Are others seeing it too?
Comment #169
penyaskito@Liam I'd recommend opening a new issue.
Comment #170
Liam MorlandLooking at it more, I think we're experiencing #3221375: Wrong language field labels after `drush cr` because of Drush language negotiation.
Comment #171
joseph.olstad@Liam Morland, #77 didn't work for us, and I didn't use drush to rebuild cache.
Debugged the cache tags, the language context is there and the language code shows up in the debug. Still getting the unexpected label values and it seems to be rather isolated.
We're getting this with display manager. I will try converting it to layout_builder, I suspect the issue will go away with layout_builder but not sure why.
Comment #172
joseph.olstadChanging to layout builder didn't make a difference.
I'm surprised that this is an outstanding issue.
Seems like there's a problem with the language context and the cache tags not being respected
Comment #173
joseph.olstadPatch I tried at 3114824 sounded promising but didn't help either.
#3114824: Add multilingual support for caching basefield definitions
Comment #174
joseph.olstadWorkaround, I wasn't able to find a better way for now.
Here is an example of what I did, but not exactly since I targetted the preprocess_field a bit more but for this example I'm flattenning it out.
In this example it's the hook_preprocess_field , but in my case I added a new twig based on the theming suggestions and used hook_preprocess_field__node__field_from__news() instead.