i18n uses custom_url_rewrite() to give paths language-dependent aliases. This works when a module calls drupal_get_path_alias(). However, the parallel implementation is missing. drupal_get_normal_path() also invokes custom_url_rewrite(). i18n needs to respond, returning the normal path.
To put the case another way: every custom_url_rewrite() implementation should have not just one but two parts:
- Respond to an 'alias' request as passed in by
drupal_get_path_alias(), to convert an path into a new format. - Do the opposite: given what is potentially an alias, respond to a 'source' request as passed in by
drupal_get_normal_path()and return the normal path.
This error has come up e.g., in this bug, http://drupal.org/node/96934.
The fix is easy. We already have the needed function, i18n_get_normal_path(). All we need to do is add a call to this to the custom_url_rewrite() implementation.
Patch attached. This patch fixes the issue in activemenu module.
| Comment | File | Size | Author |
|---|---|---|---|
| i18n-custom_url_rewrite.patch | 1.06 KB | nedjo |
Comments
Comment #1
nedjoThis seems like a fairly straightforward fix. Any questions or issues?
Comment #2
jose reyero commentedUmmm.. yes, there's an issue.
I see what you say makes sense and this will probably fix some other funny issues with the menu system. So I'll be fixing this...
But with this patch, the 'custom_url_rewrite' logic is somehow broken. It needs to return always a path.
Comment #3
jose reyero commentedI've just committed some more polished version of this, also saving some path queries in some cases.
Please, let me know whether this works for you.
Comment #4
(not verified) commented