Token support (primarily for pathauto)

knseibert - September 17, 2007 - 20:59
Project:Internationalization
Version:5.x-2.2
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

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.

AttachmentSize
i18npathauto.module.patch.txt1.79 KB

#1

greggles - November 10, 2007 - 12:29

subscribing

#2

alextrup - November 12, 2007 - 06:58

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

Thanks a bunch!

#3

JacobSingh - November 12, 2007 - 21:04

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

#4

Xen.dk - January 7, 2008 - 08:02

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.

#5

knseibert - January 7, 2008 - 09:08

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

#6

pkej - January 7, 2008 - 14:07

Subscribing

#7

Druppel.Hosting - January 14, 2008 - 09:14
Component:Code» Experimental modules

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

AttachmentSize
i18npathauto.module.patch.txt (2)1.78 KB

#8

Xen.dk - February 8, 2008 - 15:35
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.

#9

akahn - February 8, 2008 - 15:48

Thanks, Xen, this is very helpful. :)

#10

greggles - February 8, 2008 - 15:51

@xen.dk I think your patch is missing.

#11

Xen.dk - February 8, 2008 - 17:39

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

AttachmentSize
i18n.module.token_.patch.txt1.04 KB

#12

Jose A Reyero - February 22, 2008 - 15:01

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

#13

TBarregren - February 27, 2008 - 16:53

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

#14

drewish - April 7, 2008 - 05:18

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

#15

Manuel Garcia - April 22, 2008 - 12:55

subscribing... also having this issue with pathauto

#16

Jose A Reyero - April 28, 2008 - 10:07
Status:patch (code 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)

#17

Anonymous (not verified) - May 12, 2008 - 10:14
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.