When i18n is installed support localized taxonomy
nonsie - August 2, 2008 - 19:37
| Project: | Pathauto |
| Version: | 6.x-2.x-dev |
| Component: | I18n stuff |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
I have set up path alias as [termpath-raw]/[title-raw]. My vocabulary is set up set up with the following translation mode - Localize terms. Terms are common for all languages but their name and description may be localized.
I have translated terms however the url aliases always show up in English. Is this a bug or should I make a patch for it?

#1
This does seem like a feature request to me. I've re-stated it. Since I don't use i18n I won't be able to develop this patch but if it is minimally invasive on Pathauto then it seems reasonable to me to commit it.
#2
A patch would be much appreciated.
#3
Subscribing, it strange to see multilanguage feature for nodes and not for taxonomy...
#4
subscribe
#5
subscribe
would be great to find a solution for that.
#6
If this is for the i18n module ( http://drupal.org/project/i18n ) then it should really be about adding tokens to that module to support the localized terms.
#7
Subscribing
#8
It is not an i18n issue, it is a pathauto issue to work with localized terms...
#9
But which module provides localized terms?
#10
i18n taxonomy
#11
Here is a patch that allows you to set per-language patterns for taxonomy, in the same way you can for content types. It's pretty straightforward, and I think should apply to both the 1.x and 2.x branches for Drupal 6. As you will see, this is much easier to implement in pathauto - implementing within i18n taxonomy would involve a large amount of code duplication.
Note - this works for "fully translated" vocabularies (which is the recommended approach) - i.e. I18N_TAXONOMY_TRANSLATE. Vocabularies per-language (i.e. I18N_TAXONOMY_LANGUAGE) should already work without this patch. This patch won't do anything for "Localized" vocabularies (i.e. I18N_TAXONOMY_LOCALIZE), but that is a pretty limited approach to start with and I am not sure is really supportable in pathauto.
#12
Owen - that's a very interesting idea, but feels like a heavy solution to me and I don't like the idea that Pathauto is dependent on a seldomly used contributed module. Is it not possible to provide new tokens from the i18n_taxonomy module that would "do the right thing" ?
#13
@greggles - pathauto is not dependent on i18n with this patch - if it is not installed it should work exactly as before. Also i18n module is not exactly seldom used - it is in the top 50 most popular projects, (more popular then path redirect, logintoboggan and ubercart, for example) - it is basically required if you want to build any (non-trivial) multilingual site.
I don't think i18n module providing tokens is a good solution - this might work if you only ever use the vocabulary name itself and catpath as the alias (and so could use a translated vocabulary name token) - but if you need to prefix the aliases with text to place them in some site section (as is the case most of the time in my experience) you need an interface to set this text prefix. This means admins would need to go to some i18n admin page to add and configure special tokens to translatable "vocabulary paths" (basically just tokens that convert to short translatable plain text strings), and then go to locale module and translate those strings, and then go to the pathauto page and add the tokens they previously configured.
This approach would extremely complex from an admin point of view and fragile from a technical point of view, in addition these tokens would be specific to aliases, so would not be useful for anything else. I think it is better for pathauto to provide a consistent interface - it already handles the language perfectly in the backend, we just need to change 2 lines of code so the term language is actually loaded and passed to pathauto_create_alias().
#14
I was a bit confused - I thought "i18n taxonomy" was separate from the main i18n module. I see now that it is a sub-module which makes it hard to know whether it truly is in the top 50 or not.
The fact that node translations are in core and taxonomy not puts us in a tricky position. I'll wait for Freso to weigh in on this because I am hesitant to add it, but don't do much work with i18n so better for a more knowledgable person to provide feedback.
One problem we had with the i18n node code is that there are a few bugs with it. I would be happier to accept this if you could also provide some simpletests to help us know that we don't break it in the future.
And thanks again for your hard work providing the patch and (maybe harder) explaining it to me ;)
#15
Here's a version of Owen's patch in #11 that works with localized vocabularies. Use with caution as I haven't tested it very thoroughly and it fudges the language property of each term object (which are language independent in localized vocabularies) to get around the lack of i18n support in the token module.
Patterns can be specified per language - use the [i18n-cat] and [i18n-cat-raw] tokens to get the translated term name provided by i18ntaxonomy.
#16
Sub
#17
+1
#18
+1 is not helpful.
#19
Sub
#20
sub
#21
subscribe
#22
subs are not helpfull too
will test this tomorrow evening
#23
I just applied the patch and it works great!
Subscribe!