When taxonomy terms are translated using i18n (translation.module), the token generation for [termpath-raw] and [termpath] fails due to the parent terms not being loaded.

The reason for this is that pathauto makes use of taxonomy_get_parents_all which in turn makes us of db_rewrite_sql which causes i18n_db_rewrite_where (i18n.module: 772) to rewrite the SQL query to this:

SELECT t.tid, t.* FROM {term_data} t INNER JOIN {term_hierarchy} h ON h.parent = t.tid WHERE (t.language ='en' OR t.language ='' OR t.language IS NULL) AND ( h.tid = %d ) ORDER BY weight, name

The part WHERE (t.language ='en' OR t.language ='' OR t.language IS NULL) is responsible for taxonomy_get_parents_all not being able to query the parents for terms not using the currently active language ('en' in this example).

The patch solves this by setting the current language to the term language, querying the parents and then resetting the current language.

CommentFileSizeAuthor
pathauto.patch1.23 KBaccount-deletion-needed

Comments

greggles’s picture

I don't like the idea of providing code specific to some other random contrib to Pathauto. If i18n were in core that's different.

IMO, this should be addressed with some tokens provided by the i18n module that do the right thing for these situations.

Of course I defer to Freso on this point in general...

dave reid’s picture

Status: Needs review » Closed (duplicate)