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.
| Attachment | Size |
|---|---|
| i18npathauto.module.patch.txt | 1.79 KB |

#1
subscribing
#2
I just installed and tried this on my 5.3 installation - works perfectly!
Thanks a bunch!
#3
Works like a charm. Oh man, this setup with token is so much better than before :)
#4
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
Sounds good. If you could provide a patch? Would be appreciated. Could take some time until i will be able to post one.
#6
Subscribing
#7
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
#8
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
Thanks, Xen, this is very helpful. :)
#10
@xen.dk I think your patch is missing.
#11
@greggles indeed it is.. I'll try again.
#12
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
I have added this to the #227550: Patch bundle.
#14
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
subscribing... also having this issue with pathauto
#16
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
Automatically closed -- issue fixed for two weeks with no activity.