Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Steps to reproduce:
- Enabled Translation
- Add French language
- Enable the language switcher block
- Create an article
The language switcher blocks shows the french links disabled instead of active and pointing to same node with french UI.
Comment | File | Size | Author |
---|---|---|---|
#27 | translation-1060246-27.patch | 4.53 KB | plach |
#13 | translation-1060246-13.patch | 4.46 KB | plach |
#13 | translation-1060246-13-test.patch | 2.98 KB | plach |
#1 | translation-1060246-1.patch | 2.47 KB | plach |
#1 | translation-1060246-1-test.patch | 1.41 KB | plach |
Comments
Comment #1
plachThe test-only patch is supposed to fail to show the bug.
Comment #2
montesq CreditAttribution: montesq commented-edit-
cross post
Comment #3
montesq CreditAttribution: montesq commentedComment #5
plachTests pass and capture the bug. This should be ready to go. Someone please confirm.
Comment #6
plachThis looks pretty nasty after all.
Comment #7
montesq CreditAttribution: montesq commentedThis behaviour is explicitly introduced by the function "translation_language_switch_links_alter".
Could you have a look at this code and tell what is wrong for you?
I think this is more a feature request than a bug report...
Comment #8
plachSorry for not mentioning before, I thought it was obvious. This is an unwanted regression from the D6 behavior, which I probably introduced in #518364: Nodes with one language don't affect the language switcher block. This is the reason for the major priority.
Comment #9
plachPerhaps the OP is not clear about this: translation alters the language switcher links even for content types not having multilingual support set to "Enabled, with translation". In this case node translations should not be taken into consideration.
Comment #10
klonossubscribing...
Comment #11
sunLooks good.
Comment #12
ogi CreditAttribution: ogi commentedsubscribe
Comment #13
plachThe previous solution was incomplete as it didn't take into account translations created before disabling translation support for a certain content type and, above all, language neutral nodes which should not have language switch links altered.
Tests are updated accordingly.
Comment #14
plachRelated issue: #1078980: Language neutral not available when there are disabled languages.
Comment #15
plachRelated issue: #1078656: Drupal 7, Multilingual OK, but can't change language on all pages..
Comment #16
plachResults are not coming back, but patches pass/fail tests as they are supposed to. We need someone confirming the solution is ok.
Comment #18
plachComment #19
mattcasey CreditAttribution: mattcasey commentedsubscribing
Comment #20
Gábor HojtsyI did not actually test the patch but it looks simple and good, and covers the language neutral and the previously translation enabled nodes as well nicely.
Comment #21
plach@Gábor Hojtsy:
Thanks!
Can we have someone confirming the patch works? It has been reviewed and bot tested, we are only missing a human test to RTBC it.
Comment #22
klonos...would testing the steps described in the issue's description suffice?
Comment #23
plachThat would be incomplete, you should also test the use cases cited in #13 (they are described in the simpletest comments).
Comment #24
klonosk... give me some time to setup a vanilla d7 + i18n.
Comment #25
plachi18n is not needed, this is a plain core bug :)
Comment #26
sunnode_load() might return FALSE, in which case the empty() will be TRUE, subsequently triggering PHP notices due to trying to access properties of an object that doesn't exist.
Powered by Dreditor.
Comment #27
plachThanks!
(sun just cannot be cheated ;)
Comment #28
klonos...ok got me some time to set it up and configure it (I ended up re-opening #729146: Language switcher block (User interface text language detection) doesn't appear btw) + I needed grasp how core translation actually works.
Anyways, from what I saw the patch in #27 fixes things. So does that count for RBTC? ...well that plus Daniel's review ;)
Comment #29
plachI'd say this should be RTBC, but let's wait and see whether sun has any pending concern.
Comment #30
klonoscool ;)
Comment #31
sunI guess this is good to go then.
Comment #32
omercioglu CreditAttribution: omercioglu commentedsubscribing
Comment #33
plachBugs are fixed in the development version first, backported then.
The patch still applies and tests pass, so confirming RTBC status.
Comment #34
HnLn CreditAttribution: HnLn commentedsub
Comment #35
Tor Arne Thune CreditAttribution: Tor Arne Thune commentedSubscribing
Comment #36
JamFar CreditAttribution: JamFar commented+1. Subscribing.
Comment #37
plachComment #38
Dries CreditAttribution: Dries commentedCommitted this patch to 7.x and 8.x. Thanks for the tests -- we like!