Hi there,
since the pathauto/contrib/pathauto_node_i18n.inc was recently removed from the 5.2 cvs i began writing a small module which provides the necessary [lang] token for pathauto.

Currently it works for me.

Patch attached.
Feedback appreciated.

Comments

greggles’s picture

subscribing

ALT83’s picture

I just installed and tried this on my 5.3 installation - works perfectly!

Thanks a bunch!

JacobSingh’s picture

Works like a charm. Oh man, this setup with token is so much better than before :)

xen’s picture

I'd suggest removing i18n_get_lang() and replacing it with an empty string. This will effectively strip the language prefix for nodes that has no set language, which makes sense for language neutral content.

Including that change, it works as advertised here.

knseibert’s picture

Sounds good. If you could provide a patch? Would be appreciated. Could take some time until i will be able to post one.

pkej’s picture

Subscribing

Druppel.Hosting’s picture

Component: Code » Experimental modules
StatusFileSize
new1.78 KB

The patch in #4 by Xen.dk is pretty self explanatory:

on line 13 change:

$values['lang'] = i18n_node_get_lang($object->nid, i18n_get_lang());

To

$values['lang'] = i18n_node_get_lang($object->nid, '');

Attached the new patch

xen’s picture

Title: i18npathauto.module (Support for pathauto 5.2 with tokens) » Token support (primarily for pathauto)
Version: 5.x-1.x-dev » 5.x-2.2
Component: Experimental modules » Code

I don't think this should be a separate module. It's just 2 small functions that'll do nothing if the token module isn't enabled, so I've taken the liberty of integrating it into i18n.module and created a patch.

I've only renamed the functions and removed the check if i18n is enabled. Patch against 5.x-2.2, but it's just the addition of 2 functions, so it should be easy to move to HEAD or whereever.

akahn’s picture

Thanks, Xen, this is very helpful. :)

greggles’s picture

@xen.dk I think your patch is missing.

xen’s picture

StatusFileSize
new1.04 KB

@greggles indeed it is.. I'll try again.

jose reyero’s picture

The node part looks good, though as the node itself is passed as $object you could get the language straight from there.

I don't understand at all the taxonomy part

TBarregren’s picture

I have added this to the #227550: Patch bundle.

drewish’s picture

since in D6 the language field is now in core there's a patch to add this to token's 6.x branch: #233076: Add token for node's language

manuel garcia’s picture

subscribing... also having this issue with pathauto

jose reyero’s picture

Status: Needs review » Fixed

I still don't understand why the taxonomy part and this 'language code' token is quite limited, language name would be nice too.

But ok, committed by popular demand :-)

(Thanks)

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.