Hello,
I have the latest stable of all the following modules
Content Translation
Locale
Internationalization
Multilingual Content
i18n_redirect
and Global Redirect.
When I enable "Language Path Checking" I get an endless redirect loop.
Why I want to enable that? Because it seems i18n_redirect is not working. Language prefixed paths with no translated content are not redirecting to the one that is available for example
http://proofreadbot.com/proofreading/188055
Is in English, when I do es/proofreading/188055 it should redirect to http://proofreadbot.com/proofreading/188055 but it leaves the es prefix.
I don't have a language key configured for the default "en" here, but on another site where I have English as the default language with a language key "en" global redirect with language checking works.
Comment | File | Size | Author |
---|---|---|---|
#3 | 1862886.3-globalredirect-redirect-loop.patch | 681 bytes | mrfelton |
#1 | 1862886.1-globalredirect-redirect-loop.patch | 553 bytes | mrfelton |
Comments
Comment #1
mrfelton CreditAttribution: mrfelton commentedI have a very similar issue. I have 2 languages enabled:
ie (default, no path prefix)
en (path prefix = 'en')
If I create a node that is set to 'ie' (the default language), I get a redirect loop - visiting /thenode shows the node. However, visiting /en/thenode gives a redirect loop.
If I create a node that is set to 'en' (a secondary language with a prefix), everything works as expected - visiting /en/thenode shows the node, and visiting /thenode redirects to /en/thenode.
The problem seems to be in the following block of code:
globalredirect_goto
is passed$options
, which already has$options['prefix']
set to the current interface language. This means constantly tries to redirect to /en/thenode. The comment in the code indicates that by setting$options['language']
, the goto should use the proper prefix. This is incorrect. You need to set$options['prefix']
to do that. The attached patch resolves my redirect loop, and gets the language redirection working as expected.Comment #2
giorgio79 CreditAttribution: giorgio79 commentedWOW, THAT IS AWESOME. SORRY FOR THE CAPS, BUT I AM VERY HAPPY :P
Installed patch, works as expected. Fantastic.
Comment #3
mrfelton CreditAttribution: mrfelton commentedPrevious patch was slightly wrong. We should not set $options['prefix'] at all This is determined by drupal_goto using the prefix in $options['language']. We need to ensure that prefix is not set at all. Patch updated.
Comment #4
giorgio79 CreditAttribution: giorgio79 commentedYep, works for me. Very nice.
Comment #5
giorgio79 CreditAttribution: giorgio79 commentedSpoke too soon. Found a small issue whereby content that is language neutral (und) the node still gives an endless loop. If $node->language is set it works fine.
Comment #6
giorgio79 CreditAttribution: giorgio79 commentedOk the patch works, I was getting an endless loop because of this bug in Services #1668422: Default language to undefined on node if no language is set. the language field was completely empty...If I set it to und the patch works fine.
Comment #7
jm.federico CreditAttribution: jm.federico commentedHello
You might want to check #1843500: Wrong usage of prefix in Global Redirect (Patch attached) which fixes prefixes in this module.
It will happen with whatever module you have that uses prefixes, not only i18n.
Cheers
Comment #8
jm.federico CreditAttribution: jm.federico commentedI'm markin this as needs works
Prefixes are more complex than just language selection. Language selection is by far the most common one but not the only one.
This is an example site
http://www.redservi.co/
which uses prefixes to change content and language. It has a module that prepends the country to the language prefix.
2 countries 2 languages
http://www.redservi.co/RD-es
http://www.redservi.co/RD-en
http://www.redservi.co/CO-es
http://www.redservi.co/CO-en
There is a patch in #1843500-3: Wrong usage of prefix in Global Redirect (Patch attached) that changes how globalredirect plays with prefixes.
The real problem is that globalredirect is using the paths in the wrong way. Right now it uses the request path to start all the comparison magic, but we should use the current_path() which doesn't include the prefix.
I have had this issue for a while now, and it comes from D6, happened with strongarm and purl module that also uses prefixes.
I'm sorry if I'm being a bi pushy with this but I do thing that this needs addressing.
I make extensive use of prefixes and I haven't been able to use the orignal globalredirect because of this.
If I'm not being clear let me know and I'll try to rephrase things.
Hope you all have an awesome 2013!
Comment #8.0
jm.federico CreditAttribution: jm.federico commentedsdfgsdfg sdfg sdfg sdfg sdfg
Comment #9
devad CreditAttribution: devad commentedPatch #3 worked for me. However, better solution is on the way, so I'm closing this as duplicate of #1843500: Wrong usage of prefix in Global Redirect (Patch attached)
Comment #10
YoaThe patch in #1843500: Wrong usage of prefix in Global Redirect (Patch attached) didnt work for me while patch #3 from here did work..
using i18n_redirect