I really don't know if this is a settings problem or a bug with multilanguage sites.
When is configured more than one language and the language detection's method is URL (prefix), all links generated by linkit adds the language prefix on the link.
It was tested with both versions (dev and stable)
Comments
Comment #1
mordonez commentedHere is a patch which fix the issue. I hope this is okay.
Comment #2
mordonez commentedchange status
Comment #3
yan commentedI'm experiencing a similar problem, but it seems to be different: Absolute links in my html text to my own website (like http://example.com/de/whatsoever) are changed to http://example.com/de/de/whatsoever when the setting "Correct URLs with Pathologic" is enabled. I thought this might be related because of this:
#1806678: Multilingual site, paths not prefixed with language
But the patch doesn't change anything.
Comment #4
anonFixed in 7.x-3.x
Comment #6
knalstaaf commentedI'm using 7.x-3.x-dev and this issue is still occuring. Links are built like this:
domain.com/nl//nl/my-page(remark the double slash between the prefix).I'm using the following settings in the profile:
Comment #7
anonWhat field type are you using?
The default for field should not be alias, as it will transform the link itself.
Comment #8
knalstaaf commentedI'm using a link-field, afaik there's no option there to output it as an alias.
Comment #9
anonBut you said that the profile you using has "Insert methods: Raw url (alias paths)".
Comment #10
knalstaaf commentedOw you mean the insert method; that was "Alias paths" indeed. I've changed it to "Raw paths".
It shows "node/46" in the edit page now, but when it's saved, it's output as a correct alias. Which is perfect.
Thanks!
Comment #11
anonWe need a similar solution for 7.x-2.x as we have in 7.x-3.x
Comment #12
anonTry this patch for 7.x-2.x
Comment #13
gurvan commentedthe patch is not working for me, same configuration as above
Comment #14
anonAnd by "not working" you mean dont apply or dont solve the issue?
Comment #15
gurvan commentedIt don't solve the issue
Comment #16
peter törnstrand commentedHaving the same problem. Patch in #12 does not solve the problem.
Comment #17
peter törnstrand commentedSorry, disregard my last post. I'm using 2.x and applied the 3.x patch ... when applying the correct patch for 2.x it works.
Comment #18
Sneakyvv commentedShouldn't the language not be used at all?
This patch is for 7.x-2.x and adds an empty language so no prefix whatsoever is added.
Comment #19
Sneakyvv commentedpatch without parents paths
Comment #20
bart.hanssens commentedComment #21
Anonymous (not verified) commentedBumped into the same issue.
Patch #19 worked for me: thanks!
Comment #22
joelpittetMoving to 3.x - dev with patch.
Maybe a better solution would be a hook that this could be changed with OR only apply this when there is a fallback strategy in place?
Comment #23
joelpittetWell that didn't work it needs to happen all the time or else the url() will use language_url global.
Comment #24
PascalAnimateur commentedRe-rolled patch without the comments.
This works in my case..
Comment #25
gaxze commentedTried something else which worked on my site.
Comment #27
gaxze commentedPatch failed for some reason. Regenerated the patch.
Comment #28
gaxze commentedComment #29
PascalAnimateur commentedWill test the patch later today, but how about linking to content in a specific language, different than the current one? Would it be possible for the user to have the option of choosing the language prefix when creating the link?
Comment #30
gaxze commentedGone a step further - fixed issue with wysiwyg editors. Found that there is a massive difference between how Drupal renders a link from a link field(using linkit) or from the wysiwyg(using linkit).
Comment #31
PascalAnimateur commentedConcerning my previous comment #29, I figured out pathologic was causing trouble by systematically replacing the language prefix (which prevented linking to other languages via the normal link widget in ckeditor) .. this is fixed with the patch from #2628348-4: Language prefix is not split off because of caching.
As for the proper way of addressing the language prefix issue in Linkit, I still think it would be useful to have the option of choosing the language when creating a link. Although with the patch from #30, which assumes the current language by default, translating a node would also translate all of its links automatically (storing /node/18 instead of /en/node/18 if I understand the patch correctly).
Comment #32
PascalAnimateur commentedHmm.. concerning my last comment, the behavior I'm describing (auto-translating links inserted with linkit when translating a node) is only possible using pathologic with the patch I referenced above and by using my patch from #24 (which always removes the language prefix).
Comment #33
joelpittetFYI @PascalAnimateur, I've been using #24 for quite some time without any real problem. The setup I have is entity_translation and en-CA/en-US path prefixes. Using
/node/123or/article/top-10-modules-for-content-editorsinstead of hard coded path prefixes means that the shared content in the body field between the two sites will have their links work in both sites. The reason is for both English is because of some legal wording from USDA around what products are allowed to say in technical terms. Though most of the site is the same copy for both sites. And pricing is different.Comment #34
gaxze commentedFound out that #30 add's '/' to all urls, external or internal.
Comment #35
gaxze commentedI should probably just combine these patches of patches..
Comment #36
gaxze commentedI'm having a long day. Uploaded an older patch(the original..). Take 7534853586856...
Comment #37
gaxze commentedComment #38
Jeremy B commentedDo all links need to be re-saved once patch is applied ?
Comment #39
anonA test for this is needed.
Comment #40
nord102I have modified #37 to not use alias' but instead use the internal path (e.g. "/node/123") for links. I have also added functionality that adds the language prefix when necessary.
Comment #41
nord102Found that when linking to files, the prefix was already being included and therefore was adding twice. Added functionality to the patch in #40 to check whether or not the path being created contained the current language prefix before attempting to add it.
Comment #42
nord102Modified the patch in #41 so that the functionality works as expected when the Linkit profile url_method is either using Raw paths or Raw paths, with a slash (/) in the beginning