Hierarchical select doesn't play well with i18n on the node edit forms. i18n sets a couple of variables when on the node edit form, but when the form is called through ajax in hierarchical_select_json, these variables don't get set, because the arg(0) isn't 'node'. I originally tried restoring the arg's #486482: Restore path, but discovered that solution had other side-effects.

To reproduce the problem, you need a content type with a translatable taxonomy that uses hierarchical select. The taxonomy should be translated using terms (the vocabulary language is empty, and the taxonomy language is set). When you try to node/add this form, the hierarchical select terms are originally set to the right language. But when you pull down the hs term to get the second level terms, the ajax callback now has the wrong language, so it populates the top level now with the wrong language terms.

The attached solution is to save the i18n mode and params in the cache when the form is built and saved (in hierarchical_select_after_build), and then to restore these i18n variables when the form is rebuilt in hierarchical_select_json. I don't like this solution because it has built in specific knowledge about i18n. But it's the simplest solution I've been able to find.

CommentFileSizeAuthor
#1 487048.patch1.34 KBdouggreen
hsi18n.patch3.74 KBdouggreen

Comments

douggreen’s picture

StatusFileSize
new1.34 KB

Opps, that patch included another patch with it, here's the patch for just this.

wim leers’s picture

Status: Needs review » Reviewed & tested by the community

A work-around for i18n support that requires knowledge about i18n is acceptable to me.

Is the same work-around required for Drupal 6?

I'll leave this open for a couple of days to allow others to comment, but it will definitely go in. Thanks!

wim leers’s picture

Title: HS and i18n » HS i18n support
Version: 5.x-3.x-dev » 6.x-3.x-dev
Status: Reviewed & tested by the community » Needs work

Sorry for taking so long — I've been extremely busy.

This patch looks good and it's a bit too much work to set up an environment to test this patch, so I've just chosen to trust you. The patch has been committed: http://drupal.org/cvs?commit=239142.

Now onto a D6 version of this patch!

wim leers’s picture

Status: Needs work » Closed (fixed)