This module is not aware of aliases. It will always link to node/#, even if a URL alias exists.

Comments

stratosgear’s picture

Same for me.

When I view node items they appear as node/XXX although the path alias exists.

What's more, even when I type the path alias in the browser URL bar (e.g. my/path/alias) I _do_ get to the correct page but the URL automatically changes the to original node/XXX url, so I never get to see the path alias in the browser. Weird...

I'm trying to find out whose fault it is.

xarbot’s picture

suscribed

svihel’s picture

Same here.
Subscribing

xarbot’s picture

I don't know how to do a patch so i put the code here.

The file i modified is languageinterface.module

I put this code in line 157

    $alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src like '%s'",'node/'. $destination_nid ));
    $path = rootpath() .$prefix . $alias . $remaining;

I don't know how to detect if a module is instaled, so this two lines must be added only if you have the alias module instaled.

Xarbot

stratosgear’s picture

A side effect of the above patch is that if the node does NOT have a translation, I get a page not found error, whereas in the previous behavior, I would get the original untranslated node.

Update: If I hit the url (suggested by the flag icon) manually from the browser, then I DO get redirected to the original untranslated node, but if I click on the flag icon I get the page not found error. Weird!

xarbot’s picture

Well i have the Active Translation module installed too.

This module shows the unstranlated version of the node if it has'nt traslated with a text showing that the system are showing this version because it isn't translated, so i don't have this problem...

Best regards

xarbot

Woggers’s picture

StatusFileSize
new941 bytes

This patch takes xarbot's code in comment #4 and also adds a check to ensure that the Path module is enabled. If not it defers to the original node/* pathing.

I was having massive problems with i18n v6-x-1.1 and the language switcher (url aliases not working for anything but default) but using this module now, along with this patch everything seems to work as it should!

lightnin’s picture

Hmm... tried to apply this patch to latest version and got this error:

/usr/share/drupal6/sites/default/modules/languageinterface$ patch < languageinterface.patch
patching file languageinterface.module
Hunk #1 FAILED at 155.
Hunk #2 succeeded at 482 (offset 7 lines).
1 out of 2 hunks FAILED -- saving rejects to file languageinterface.module.rej

I'm very new to patching, so sorry if the solution to this problem is obvious.

jolidog’s picture

Version: 6.x-2.1 » 6.x-2.3
Priority: Normal » Critical
Status: Active » Needs review
StatusFileSize
new1.1 KB

Here is a patch for the 2.3 version. It's the same principal of the previous patch. I'm sure there might be a better way of doing this, perhaps without a call directly to the DB.
Only tested with the option "path prefix only."

Can someone else test it, so this can get fixed?

Also marking this as Critical, to get the mantainer attention.

Thanks!

lelizondo’s picture

is working for me but as you said, there might be a better way of doing this. Thanks.

Edit: I'm going to take back what I've said. Seems that when the node has no alias it will send you to the frontpage.

CalonDdraig’s picture

I'm having problems with 6x-2.5 ... The module is not path aware. Is the above patch safe to apply to 2.5?

Really hoping that path awareness can be incorporated into the module at some point so we don't have to keep patching.

Cheers,

CalonDdraig

CyB66’s picture

subscribe

bartezz’s picture

Version: 6.x-2.3 » 6.x-2.5

Using 2.5 but the patch in #9 applies just fine.
Still having problems with path aliases tho.

My case;

- A page view with a view path of 'view/news'

In admin/build/path/list I have created a couple of url aliases;

Alias ------- System ---- Language

newslisting - view/news - EN
nieuws ----- view/news - NL
neuigkeiten - view/news - DE

When using the switcher block provided by this module to switch from /en/newslisting to the german version I'm not getting /de/neuigkeiten but /de/newslisting which throws an 404....

Very critical as this renders the switcher block completely unusable for now and it breaks my site :'(

Cheers

bartezz’s picture

StatusFileSize
new1.65 KB

Ok, I think I've fixed this with the patch below. This patch is made against 6.x-2.5 and includes the patch in #9.
With this patch paths for non-nodes (views, taxonomy, etc) should work as well.

I've tested on the issue in #13 and that problem has been solved with this patch!

Please test and post back so this patch can get committed!!

Cheers

PixelClever’s picture

Version: 6.x-2.5 » 6.x-2.6

I'm afraid these patches all caused secondary issues when I tested, but that's not really your fault. The logic in some of these sections was faulty, and I hadn't had the time to work on it for the past year. The 2.6 version completely rewrites this section and a bit more. I have had some issues with cvs on the the commit, so please let me know if there are problems.

Don't use my personal contact form though. No maintainer takes kindly to personal emails regarding the issue queue. All issue comments come to my mail box anyway. This is addressing a specific user on this thread who broke that rule. I say this because I want to make it clear that it doesn't motivate me to work on a module when someone crosses that line.

PixelClever’s picture

Status: Needs review » Closed (fixed)
bartezz’s picture

Status: Closed (fixed) » Active

Hi Aaron,

Point taken ;)

Sorry to open this issue again but I've just downloaded and tested 6.x-2.6 but there still are some issues. What I've found now is that the issue mentioned in O.P. is back again? All links from the block point to node/# eventhough url aliases are available.

Cheers

PixelClever’s picture

Argh! I hate cvs. This keeps happening to me. I just downloaded 2.6 and it doesn't have any of the changes I committed. I'll try again. There was a cvs sticky tag on this module that was messing things up. Apparently it's been buggered since 2.3.

PixelClever’s picture

I created a 3.0 version because there were already issues with stickytags cluttering up 2.7 and 2.8, might as well start fresh. Let me know if the li_helperfunctions.inc is present in the download. It shouldn't be. If it is then my commit failed again.

bartezz’s picture

Just downloaded and tried 3.0 version and that seems fine for nodes and views. Haven't tried/tested on anything else yet but so far it's looking good!

Cheers

PixelClever’s picture

Status: Active » Closed (fixed)
gaele’s picture

Thanks Aaron!

bartezz’s picture

Version: 6.x-2.6 » 6.x-3.6
Status: Closed (fixed) » Active

Just downloaded and installed 6.3 version and it's back again.
The links in the language selection block (by your module) point to the correct node IDs but don't pickup the aliases for them.

Also aliases for views don't seem to be working anymore...

Cheers

mikey_t’s picture

subscribe

nilsja’s picture

same problem here with 7.x-1.x-dev

nilsja’s picture

is there a fix for drupal 7?

lklimek’s picture

StatusFileSize
new531 bytes

For Drupal 7 please try the patch attached and confirm that it works.

idflood’s picture

Thanks lklimek, your patch looks good.
In #1236634: change language doesn't respect source alias "clashar" confirmed that it worked for him. I've also successfully applied it. Noe the behave exactly how it should. The code looks clean too.

lklimek’s picture

Thanks, idflood, committed to 7.x-1.x.

sgabe’s picture

Also aliases for views don't seem to be working anymore...

I can confirm that aliases for views don't work with 6.x-3.6.

luksak’s picture

You reverted this commit in your last commit for 7.x-1.x. Is there a reason?

psf_’s picture

Issue summary: View changes

For version 7.x-1.x-dev, 2014-Nov-26, I change line 132 of languajeinterface.module:

$link['path'] = 'node/' . $nid . '/' . $rest;

to:

$link['path'] = drupal_get_path_alias('node/' . $nid, $lang) . '/' . $rest;

And now work with pathauto and multilingual content.