HS i18n support
| Project: | Hierarchical Select |
| Version: | 6.x-3.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
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.
| Attachment | Size |
|---|---|
| hsi18n.patch | 3.74 KB |

#1
Opps, that patch included another patch with it, here's the patch for just this.
#2
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!
#3
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!
#4
Ugh, the D6 version of this patch has its own issue: #341993: Hierarchical Select: use the special translation function provided by the i18n module.